Skip to main content

WriteableBitmapImpl

Struct WriteableBitmapImpl 

Source
pub struct WriteableBitmapImpl { /* private fields */ }
Expand description

Skia based writeable bitmap.

The UI thread writes the pixels and the render thread draws them: the pixels and the image drawn from them are under one lock.

Implementations§

Source§

impl WriteableBitmapImpl

Source

pub fn from_stream(stream: &mut dyn Read) -> Result<Arc<Self>>

Creates a writeable bitmap from the given stream.

Source

pub fn from_stream_to_size( stream: &mut dyn Read, decode_size: i32, horizontal: bool, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<Self>>

Creates a writeable bitmap from a stream, decoded so that its width (horizontal) or height is decode_size.

Source

pub fn new( size: PixelSize, dpi: Vector, format: PixelFormat, alpha_format: AlphaFormat, ) -> Arc<Self> ⓘ

Creates a writeable bitmap with the given size, DPI and formats. The pixels start out transparent.

§Panics

Panics when the pixel format is unknown to Skia or the pixels cannot be allocated.

Source

pub fn get_snapshot(&self) -> Image

Gets a snapshot of the bitmap: an image holding a copy of the current pixels.

Trait Implementations§

Source§

impl IBitmapImpl for WriteableBitmapImpl

Source§

fn dpi(&self) -> Vector

The dots per inch (DPI) of the image.
Source§

fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.
Source§

fn version(&self) -> i32

Version of the pixel data: incremented whenever the content changes.
Source§

fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a stream, encoded as selected by options.
Source§

fn dispose(&self)

Releases the bitmap’s resources.
Source§

fn as_any(&self) -> &dyn Any

Lets the backend recover its concrete type.
Source§

fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>

The bitmap viewed as IReadableBitmapImpl, when its pixels can be read.
Source§

impl IDrawableBitmapImpl for WriteableBitmapImpl

Source§

fn draw( &self, gr_context: Option<&dyn ISkiaGrContext>, canvas: &Canvas, source_rect: &Rect, dest_rect: &Rect, sampling_options: SamplingOptions, paint: &Paint, )

Draws the bitmap onto a canvas. Read more
Source§

impl IReadableBitmapImpl for WriteableBitmapImpl

Source§

fn format(&self) -> Option<PixelFormat>

The pixel format, if known.
Source§

fn alpha_format(&self) -> Option<AlphaFormat>

The alpha format, if known.
Source§

fn lock(&self) -> Rc<dyn ILockedFramebuffer>

Locks the pixels for reading (and writing, for writeable bitmaps).
Source§

impl IWriteableBitmapImpl for WriteableBitmapImpl

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.