UnownedBitmapMut

Struct UnownedBitmapMut 

Source
pub struct UnownedBitmapMut<'a> { /* private fields */ }
Expand description

A mutable Bitmap that is not owned by the application, so can only be used as a borrowed BitmapRef.

A UnownedBitmapRef can be cloned which is a shallow clone that produces access to another mutable borrow on the unowned Bitmap.

Methods from Deref<Target = BitmapRef>§

Source

pub fn load_file(&mut self, path: &str) -> Result<(), Error>

Loads the image at path into the previously allocated BitmapRef.

Source

pub fn data(&self) -> BitmapData

Returns the bitmap’s metadata such as its width and height.

Source

pub fn as_bytes(&self) -> &[u8]

Gives read acccess to the pixels of the bitmap as an array of bytes.

Each byte represents 8 pixels, where each pixel is a bit. The highest bit is the leftmost pixel, and lowest bit is the rightmost. There are Bitmap::data().rowbytes many bytes in each row, regardless of the number of pixels in a row, which can introduce padding bytes between rows. For this reason, the Bitmap::as_pixels() method is recommended, and easier to use.

Source

pub fn as_mut_bytes(&mut self) -> &mut [u8]

Gives read-write acccess to the pixels of the bitmap as an array of bytes.

Each byte represents 8 pixels, where each pixel is a bit. The highest bit is the leftmost pixel, and lowest bit is the rightmost. There are Bitmap::data().rowbytes many bytes in each row, regardless of the number of pixels in a row, which can introduce padding bytes between rows. For this reason, the Bitmap::as_pixels_mit() method is recommended, and easier to use.

Source

pub fn as_pixels(&self) -> BitmapPixels<'_>

Gives read acccess to the individual pixels of the bitmap.

Source

pub fn as_pixels_mut(&mut self) -> BitmapPixelsMut<'_>

Gives read-write acccess to the individual pixels of the bitmap.

Source

pub fn clear<'a, C: Into<Color<'a>>>(&mut self, bg_color: C)

Clears the bitmap, filling with the given bg_color.

Source

pub fn set_mask_bitmap(&mut self, mask: &BitmapRef) -> Result<(), Error>

Sets a mask image for the given bitmap. The set mask must be the same size as the target bitmap.

The mask bitmap is copied, so no reference is held to it. Returns an Error::DimensionsDoNotMatch if the mask bitmap dimensions do not match with self.

Source

pub fn mask_bitmap(&self) -> Option<UnownedBitmapMut<'_>>

The mask bitmap attached to this bitmap.

Returns the mask bitmap, if one has been attached with set_mask_bitmap(), or None.

Trait Implementations§

Source§

impl AsMut<BitmapRef> for UnownedBitmapMut<'_>

Source§

fn as_mut(&mut self) -> &mut BitmapRef

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<BitmapRef> for UnownedBitmapMut<'_>

Source§

fn as_ref(&self) -> &BitmapRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for UnownedBitmapMut<'_>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Deref for UnownedBitmapMut<'_>

Source§

type Target = BitmapRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for UnownedBitmapMut<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for UnownedBitmapMut<'a>

§

impl<'a> RefUnwindSafe for UnownedBitmapMut<'a>

§

impl<'a> !Send for UnownedBitmapMut<'a>

§

impl<'a> !Sync for UnownedBitmapMut<'a>

§

impl<'a> Unpin for UnownedBitmapMut<'a>

§

impl<'a> UnwindSafe for UnownedBitmapMut<'a>

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> 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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.