Skip to main content

PixelBufferCursorExt

Trait PixelBufferCursorExt 

pub trait PixelBufferCursorExt {
    // Required methods
    fn seek_to_pixel(
        &mut self,
        x: usize,
        y: usize,
        bytes_per_row: usize,
    ) -> Result<u64, Error>;
    fn read_pixel(&mut self) -> Result<[u8; 4], Error>;
}
Expand description

Extension trait for io::Cursor to add pixel buffer specific operations

Required Methods§

fn seek_to_pixel( &mut self, x: usize, y: usize, bytes_per_row: usize, ) -> Result<u64, Error>

Seek to a specific pixel coordinate (x, y)

Assumes 4 bytes per pixel (BGRA format).

§Errors

Returns an I/O error if the seek operation fails.

fn read_pixel(&mut self) -> Result<[u8; 4], Error>

Read a single pixel (4 bytes: BGRA)

§Errors

Returns an I/O error if the read operation fails.

Implementations on Foreign Types§

§

impl<T> PixelBufferCursorExt for Cursor<T>
where T: AsRef<[u8]>,

§

fn seek_to_pixel( &mut self, x: usize, y: usize, bytes_per_row: usize, ) -> Result<u64, Error>

§

fn read_pixel(&mut self) -> Result<[u8; 4], Error>

Implementors§