Skip to main content

WriteableBitmapImpl

Struct WriteableBitmapImpl 

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

A writeable bitmap: pixels in memory, in one of the formats of the contract.

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. A bitmap of an image without alpha is opaque, as the codec of Skia reports it.

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 not one the backend reads and writes or the size has no 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 image(&self) -> Option<ImageData>

The current pixels of the bitmap as an image of premultiplied RGBA pixels, or None once the bitmap is disposed. The image is kept until the pixels change: drawing a bitmap again copies nothing.
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> AutoreleaseSafe for T
where T: ?Sized,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,