Skip to main content

BitmapBand

Struct BitmapBand 

Source
pub struct BitmapBand<'bmp, P: Pixel> {
    pub width: u32,
    pub height: u32,
    pub y_start: u32,
    pub stride: usize,
    /* private fields */
}
Expand description

A mutable view into a horizontal band of a Bitmap.

Created by Bitmap::bands_mut. Provides the same row-access interface as Bitmap<P> but covers only the rows [y_start, y_start + height).

Row indices passed to BitmapBand::row_and_alpha_mut and BitmapBand::row_bytes_mut are absolute (i.e. in the same coordinate space as the parent bitmap), not band-local.

Fields§

§width: u32

Pixel width of the band (same as the parent bitmap width).

§height: u32

Number of rows in this band.

§y_start: u32

Absolute y-coordinate of the first row in the full bitmap.

§stride: usize

Byte distance between the start of consecutive rows.

Implementations§

Source§

impl<P: Pixel> BitmapBand<'_, P>

Source

pub fn row_and_alpha_mut(&mut self, y: u32) -> (&mut [u8], Option<&mut [u8]>)

Simultaneous mutable access to the pixel row and the alpha row.

y is the absolute row index (must satisfy y_start ≤ y < y_start + height).

Returns (pixel_row_bytes, Some(alpha_row)) or (pixel_row_bytes, None).

§Panics

Panics if y is outside [y_start, y_start + height).

Source

pub fn row_bytes_mut(&mut self, y: u32) -> &mut [u8]

Raw byte mutable access to the full stride of row y.

y is the absolute row index (must satisfy y_start ≤ y < y_start + height).

§Panics

Panics if y is outside [y_start, y_start + height).

Auto Trait Implementations§

§

impl<'bmp, P> Freeze for BitmapBand<'bmp, P>

§

impl<'bmp, P> RefUnwindSafe for BitmapBand<'bmp, P>
where P: RefUnwindSafe,

§

impl<'bmp, P> Send for BitmapBand<'bmp, P>

§

impl<'bmp, P> Sync for BitmapBand<'bmp, P>

§

impl<'bmp, P> Unpin for BitmapBand<'bmp, P>
where P: Unpin,

§

impl<'bmp, P> UnsafeUnpin for BitmapBand<'bmp, P>

§

impl<'bmp, P> !UnwindSafe for BitmapBand<'bmp, P>

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