Struct ndk::native_window::NativeWindowBufferLockGuard

source ·
pub struct NativeWindowBufferLockGuard<'a> { /* private fields */ }
Expand description

Lock holding the next drawing surface for writing. It is unlocked and posted on drop().

Implementations§

source§

impl<'a> NativeWindowBufferLockGuard<'a>

source

pub fn width(&self) -> usize

The number of pixels that are shown horizontally.

source

pub fn height(&self) -> usize

source

pub fn stride(&self) -> usize

The number of pixels that a line in the buffer takes in memory.

This may be >= width.

source

pub fn format(&self) -> HardwareBufferFormat

The format of the buffer. One of HardwareBufferFormat.

source

pub fn bits(&mut self) -> *mut c_void

The actual bits.

This points to a memory segment of stride() * height() * HardwareBufferFormat::bytes_per_pixel() bytes.

Only width() pixels are visible for each stride() line of pixels in the buffer.

See bytes() for safe access to these bytes.

source

pub fn bytes(&mut self) -> Option<&mut [MaybeUninit<u8>]>

Safe write access to likely uninitialized pixel buffer data.

Returns None when there is no HardwareBufferFormat::bytes_per_pixel() size available for this format().

The returned slice consists of stride() * height() * HardwareBufferFormat::bytes_per_pixel() bytes.

Only width() pixels are visible for each stride() line of pixels in the buffer.

source

pub fn lines(&mut self) -> Option<impl Iterator<Item = &mut [MaybeUninit<u8>]>>

Returns a slice of bytes for each line of visible pixels in the buffer, ignoring any padding pixels incurred by the stride.

See bits() and bytes() for contiguous access to the underlying buffer.

Trait Implementations§

source§

impl<'a> Debug for NativeWindowBufferLockGuard<'a>

source§

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

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

impl<'a> Drop for NativeWindowBufferLockGuard<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. 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> 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>,

§

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>,

§

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.