Skip to main content

Glow

Struct Glow 

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

A long-exposure f32 buffer at Pixels resolution, w × 2·h (CORE-R85): points splat weight into it by their Dots position, decay fades it, and scenes tone-map it themselves through values and Tone::level. A soft glow under a point cloud or an event display, at an eighth of a Density’s memory (one value per pixel instead of per dot).

Implementations§

Source§

impl Glow

Source

pub fn new(cells: Size) -> Self

A zeroed buffer over cells terminal cells (w × 2·h pixels).

Source

pub fn pixel_size(&self) -> Size

Buffer dimensions in pixels, as Pixels::pixel_size.

Source

pub fn resize(&mut self, cells: Size)

Resize to cells and zero. Reuses the buffer unless it must grow.

Source

pub fn clear(&mut self)

Zero every pixel.

Source

pub fn decay(&mut self, k: f32)

Multiply every value by k, clamped to [0, 1] (NaN leaves the buffer as is): an exponential fade, k = exp(−dt / τ) per step.

Source

pub fn splat(&mut self, x: f64, y: f64, kernel: &[(i32, i32, f32)], scale: f32)

Add scale · w to pixel (px + dx, py + dy) for each (dx, dy, w) of kernel, where (px, py) is the pixel holding dot (x, y) (dot units, rounded to the nearest dot; a pixel is 2 × 2 dots). Non-finite coordinates or weights and off-buffer pixels are ignored.

Source

pub fn splat_bilinear(&mut self, x: f64, y: f64, w: f32)

Add w at continuous pixel position (x, y) (integers are pixel centres; the centre of the pixel holding dot (dx, dy) is ((dx − 0.5)/2, (dy − 0.5)/2)), split bilinearly over the four nearest pixels (CORE-R92). Motion below a pixel stays smooth and a moving source leaves no nearest-pixel stair steps; the in-bounds share of w is conserved. Non-finite input and off-buffer pixels are ignored.

Source

pub fn values(&self) -> &[f32]

Every pixel value, row-major (pixel_size().width() per row).

Source

pub fn get(&self, x: i32, y: i32) -> Option<f32>

The value at pixel (x, y), or None off the buffer.

Trait Implementations§

Source§

impl Clone for Glow

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Glow

Source§

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

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

impl Default for Glow

Source§

fn default() -> Self

A 1×1-cell buffer, the placeholder until a scene’s first resize.

Auto Trait Implementations§

§

impl Forget for Glow

§

impl Freeze for Glow

§

impl Move for Glow

§

impl RefUnwindSafe for Glow

§

impl Send for Glow

§

impl Sync for Glow

§

impl Unpin for Glow

§

impl UnsafeUnpin for Glow

§

impl UnwindSafe for Glow

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V