Skip to main content

RowAccessor

Struct RowAccessor 

Source
pub struct RowAccessor { /* private fields */ }
Expand description

Row accessor that computes row pointers via base + y * stride.

Port of C++ agg::row_accessor<int8u>.

Implementations§

Source§

impl RowAccessor

Source

pub fn new() -> Self

Create an empty (unattached) row accessor.

Source

pub unsafe fn new_with_buf( buf: *mut u8, width: u32, height: u32, stride: i32, ) -> Self

Create and attach to a buffer.

§Safety

buf must point to a valid buffer of at least height * stride.abs() bytes. The buffer must remain valid for the lifetime of this accessor.

Source

pub unsafe fn attach( &mut self, buf: *mut u8, width: u32, height: u32, stride: i32, )

Attach to a buffer.

§Safety

Same requirements as new_with_buf.

Source

pub fn buf(&self) -> *mut u8

Raw buffer pointer.

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

pub fn stride(&self) -> i32

Source

pub fn stride_abs(&self) -> u32

Source

pub unsafe fn row_ptr(&self, y: i32) -> *mut u8

Get a raw mutable pointer to a row.

§Safety

y must be in [0, height).

Source

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

Get a safe immutable slice for row y.

Returns the full row of stride_abs() bytes.

Source

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

Get a safe mutable slice for row y.

Source

pub fn row(&self, y: u32) -> RowData<'_>

Get row data (x1, x2 range + pointer).

Source

pub fn copy_from<T: RenderingBufferAccess>(&mut self, src: &T)

Copy pixel data from another buffer (min of both dimensions).

Source

pub fn clear(&mut self, value: u8)

Fill every byte in the buffer with value.

Trait Implementations§

Source§

impl Default for RowAccessor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RenderingBufferAccess for RowAccessor

Source§

fn width(&self) -> u32

Source§

fn height(&self) -> u32

Source§

fn stride_abs(&self) -> u32

Source§

unsafe fn row_ptr_const(&self, y: i32) -> *const u8

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

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.