Skip to main content

FixedHistory

Struct FixedHistory 

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

Per-pixel run history of one fixed region, laid out over its floored rect.

Implementations§

Source§

impl FixedHistory

Source

pub fn new(region: Rect) -> Self

Source

pub fn bytes(region: Rect) -> f64

Bytes the history holds.

Source

pub fn first_frame(&self) -> Option<u32>

The frame whose values FixedHistory::first starts from.

Source

pub fn closed(&self) -> bool

Source

pub fn frame0(&self) -> &[u32]

The first frame’s values, packed RGBA over the region’s rect (0 where the region owns no pixel).

Source

pub fn update( &mut self, rgba: &[u8], labels: &[u8], consistent: &[u8], width: usize, height: usize, code: u8, frame: u32, limit: u32, ) -> usize

Takes frame frame’s pixels (rgba, width × height, atlas labels, the region’s code, the region’s consistency mask consistent): a pixel that moved beyond limit (the RGB difference sum the source noise allows) from its current run ends that run. When the pixels that settled into a new value (consistent with a neighbouring frame) are more than a pointer could cover, the region changed state and the first epoch ends here. Returns that count of settled pixels.

Source

pub fn close(&mut self, end: u32)

Ends the first epoch before frame end: every current run is counted up to it, and later updates are ignored.

Source

pub fn first(&self, limit: u32) -> Vec<u32>

The first frame’s pixels with its transients replaced (call after FixedHistory::close): where the value a pixel held longest in the first epoch differs from the first frame by more than limit, inside a patch no larger than a pointer, the longest-held value; elsewhere the first frame. Packed RGBA over the region’s rect; 0 where the region owns no pixel.

Source

pub fn paint( &self, first: &[u32], rgba: &mut [u8], width: usize, height: usize, ) -> bool

Writes FixedHistory::first into a frame-sized rgba at the region’s pixels; returns whether any byte changed.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.