Skip to main content

WriteableBitmapRef

Struct WriteableBitmapRef 

Source
pub struct WriteableBitmapRef(pub Rc<WriteableBitmap>);
Expand description

A writeable bitmap held by a property.

Tuple Fields§

§0: Rc<WriteableBitmap>

Implementations§

Source§

impl WriteableBitmapRef

Source

pub fn new(bitmap: WriteableBitmap) -> Self

The handle of bitmap.

Source

pub fn get(&self) -> &Rc<WriteableBitmap>

The shared bitmap.

Source

pub fn as_image(&self) -> Rc<dyn IImage>

The bitmap as an image (the source of an image control).

Methods from Deref<Target = WriteableBitmap>§

Source

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

The pixel format of the bitmap.

Source

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

Locks the pixel data of the bitmap and returns a framebuffer that can be used to read and write the pixels. The changes are committed when the framebuffer is disposed.

Source

pub fn copy_pixels( &self, source_rect: PixelRect, buffer: &mut [u8], stride: i32, )

Copies the pixels of source_rect into buffer, whose rows are stride bytes apart. An empty source_rect selects the whole bitmap.

Methods from Deref<Target = Bitmap>§

Source

pub fn create_scaled_bitmap( &self, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Bitmap

Creates a bitmap scaled to the specified size from the current bitmap.

Source

pub fn dispose(&self)

Releases the bitmap’s reference to the platform bitmap.

Source

pub fn dpi(&self) -> Vector

The dots per inch (DPI) of the image.

Source

pub fn size(&self) -> Size

The size of the image, in device independent pixels.

Source

pub fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.

Source

pub fn platform_impl(&self) -> &RefCounted<dyn IBitmapImpl + Sync + Send>

The platform-specific bitmap implementation.

Source

pub fn save_to_file( &self, file_name: &str, options: &BitmapEncoderOptions, ) -> Result<(), Error>

Saves the bitmap to a file.

Source

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

Saves the bitmap to a stream.

Source

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

The pixel format of the bitmap, if its pixels can be read.

Source

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

The alpha format of the bitmap, if its pixels can be read.

Source

pub fn copy_pixels( &self, source_rect: PixelRect, buffer: &mut [u8], stride: i32, )

Copies the pixels of source_rect into buffer, whose rows are stride bytes apart. An empty source_rect selects the whole bitmap.

Panics when the pixels of the bitmap cannot be read, when the bitmap was converted from another pixel format on creation, or when the rectangle, stride or buffer are out of range.

Source

pub fn copy_pixels_to_framebuffer(&self, buffer: &dyn ILockedFramebuffer)

Copies the pixels of the bitmap into a locked framebuffer, converting them to its pixel and alpha formats.

Panics when the pixels of the bitmap cannot be read.

Trait Implementations§

Source§

impl Clone for WriteableBitmapRef

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriteableBitmapRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for WriteableBitmapRef

Source§

type Target = WriteableBitmap

The resulting type after dereferencing.
Source§

fn deref(&self) -> &WriteableBitmap

Dereferences the value.
Source§

impl From<Rc<WriteableBitmap>> for WriteableBitmapRef

Source§

fn from(value: Rc<WriteableBitmap>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for WriteableBitmapRef

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

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> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.