API reference

aster_blueprint::noise_surface

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Procedural noise surfaces: a noise field mapped through a colour ramp into an image, with optional film grain, painted as an ordinary [aster_ui::Recording] (the same route as every other effect image).

Speed model:

  • The field is generated at a reduced internal resolution (about [Surface::budget] samples; smooth fields are upscaled bilinearly by the renderer, so a full-screen aurora costs a few milliseconds, not a million noise evaluations).
  • Frames are cached on a thread-local LRU keyed on every parameter plus the time quantum (time is snapped to 1 / fps seconds), so an unchanged frame is a hash lookup. [cache_stats] exposes hits and misses.
  • Film grain is a pool of 256x256 tiles (8 variants per amount) drawn with Nearest sampling, so animating it costs no per-pixel work after warm-up.

Output is deterministic: identical inputs give byte-identical pixels (see [crate::noise] for the float guarantee).

Structs

structaster_blueprint::noise_surface::Surface

pub struct Surface { /* see fields */ }

A fully resolved surface description (colours are plain sRGB8).

Public fields

fieldtype
kindSurfaceKind
seedu32
scalef64Logical px per noise lattice unit (feature size).
fractalnoise::Fractal
stopsVec<(f64, [u8; 4])>Colour ramp stops (position 0..=1, rgba), sorted by position.
speedf64Lattice units per second along the time axis (0 = still).
timef64Seconds, snapped to 1 / fps.
fpsu32Frame quantum: time snaps to multiples of 1 / fps (default 30).
detailOption<f64>Internal px per sample (None = automatic from [Self::budget]).
budgetu32Target number of internal samples when detail is automatic.
grainf64Film grain amount 0..=1 (0 = none).
grain_fpsu32
cornerf64Rounded-corner radius in px (baked into the alpha).
warpf64Domain-warp strength (Warp) or gradient distortion (Aurora).
contrastf64Contrast about the ramp middle (1 = unchanged).

Methods

  • fn new(kind: SurfaceKind) -> Self — A surface of kind with a black-to-white ramp and sensible defaults.
  • fn quantized_time(&self) -> f64 — time snapped to the frame quantum.
  • fn field(&self, px: f64, py: f64, w: f64, h: f64) -> f64 — The 0..=1 field value at logical position (px, py) of a w x h surface.
  • fn lut(&self) -> [[u8; 4]; 256] — 256-entry colour lookup of the ramp.
  • fn grid(&self, w: f64, h: f64) -> (usize, usize) — Internal sample grid (iw, ih) for a w x h surface.
  • fn pixels(&self, w: f64, h: f64) -> (usize, usize, Vec<u8>) — Generate the RGBA pixels of the field at its internal resolution.
  • fn signature(&self, w: f64, h: f64) -> u64 — A hash of everything [Surface::recording] draws for a w x h surface: the field (its cache key, so the frame quantum is in it), the grain amount and the grain frame. Equal hashes, equal pictures.
  • fn image(&self, w: f64, h: f64) -> Result<Arc<ImageResource>, Error> — The (cached) image of the field alone.
  • fn recording(&self, w: f64, h: f64) -> Result<Recording, Error> — A recording of w x h logical px: the field (bilinear) plus grain.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

Enums

enumaster_blueprint::noise_surface::SurfaceKind

pub enum SurfaceKind { Value, Perlin, Simplex, Cellular, Edges, Fbm, Ridged, Turbulence, Warp, Aurora }

What field a surface shows.

Methods

  • const ALL: [SurfaceKind; 10] — Every kind, in core.noise.surface.v1 kind index order.
  • fn from_index(v: f64) -> Option<Self> — The kind for a graph kind index (0 value ... 9 aurora).
  • fn name(self) -> &'static str — A short stable name ("fbm", "edges", ...).

Variants

  • Value
  • Perlin
  • Simplex
  • Cellular — Cellular F1 distance.
  • Edges — Cellular F2 - F1: bright cell borders.
  • Fbm
  • Ridged
  • Turbulence
  • Warp — Domain-warped fBm (marble / smoke).
  • Aurora — A vertical gradient bent by slow flowing noise (aurora backgrounds).

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

Functions

fnaster_blueprint::noise_surface::cache_stats

pub fn cache_stats() -> (u64, u64)

(hits, misses) of this thread's frame cache since [clear_cache].

fnaster_blueprint::noise_surface::clear_cache

pub fn clear_cache()

Drop this thread's cached frames and grain tiles and zero [cache_stats].

fnaster_blueprint::noise_surface::even_stops

pub fn even_stops(colors: &[[u8; 4]]) -> Vec<(f64, [u8; 4])>

Evenly spaced stops for colors (a single colour is flat).

fnaster_blueprint::noise_surface::grain_commands

pub fn grain_commands(rec: &mut aster_ui::Recorder, w: f64, h: f64, amount: f64, seed: u32, time: f64, fps: u32) -> Result<(), aster_ui::Error>

Append film-grain tile commands covering a w x h box to rec (at most one command per 256 px tile). time selects the frame at fps frames/second.

fnaster_blueprint::noise_surface::grain_recording

pub fn grain_recording(w: f64, h: f64, amount: f64, seed: u32, time: f64, fps: u32) -> Result<aster_ui::Recording, aster_ui::Error>

A grain-only recording (core.noise.grain.v1, [crate::ui::noise::grain]).

fnaster_blueprint::noise_surface::grain_signature

pub fn grain_signature(w: f64, h: f64, amount: f64, seed: u32, time: f64, fps: u32) -> u64

A hash of what [grain_recording] draws.

fnaster_blueprint::noise_surface::ramp_lut

pub fn ramp_lut(stops: &[(f64, [u8; 4])]) -> [[u8; 4]; 256]

Piecewise-linear colour ramp sampled at 256 points (straight sRGB8 blend).

Constants

constaster_blueprint::noise_surface::MAX_EDGE

pub const MAX_EDGE: f64

Largest surface edge in logical px (Err(Capacity) beyond).