pub struct Plasma {
pub pixel_width: u32,
pub pixel_height: u32,
/* private fields */
}
Expand description
The struct that holds the meta information about current plasma state
Fields§
§pixel_width: u32
The plasma pixel width
pixel_height: u32
The plasma pixel height
Implementations§
source§impl Plasma
impl Plasma
sourcepub fn new<R: Rng + ?Sized>(
pixel_width: u32,
pixel_height: u32,
config: PhaseAmpCfg,
rng: &mut R,
) -> Self
pub fn new<R: Rng + ?Sized>( pixel_width: u32, pixel_height: u32, config: PhaseAmpCfg, rng: &mut R, ) -> Self
Creates new plasma instance.
Provide the initial pixel_width
and pixel_height
,
initialized PhaseAmpCfg and an instance of Rng.
sourcepub fn render<'a, B, L, M>(
&'a self,
buffer: &mut [u8],
pitch: usize,
wrkspc: Option<&mut Vec<u8>>,
)
pub fn render<'a, B, L, M>( &'a self, buffer: &mut [u8], pitch: usize, wrkspc: Option<&mut Vec<u8>>, )
Renders the plasma into the provided buffer
.
You must also provide a struct implementing PixelBuffer trait.
The pitch
should contain the number of bytes of a single line in a buffer.
The wrkspc
is an optional temporary memory scractchpad.
If None is provided the new memory will be allocated.
sourcepub fn render_part<'a, B, L, M>(
&'a self,
buffer: &mut [u8],
pitch: usize,
x: usize,
y: usize,
w: usize,
h: usize,
wrkspc: Option<&mut Vec<u8>>,
)
pub fn render_part<'a, B, L, M>( &'a self, buffer: &mut [u8], pitch: usize, x: usize, y: usize, w: usize, h: usize, wrkspc: Option<&mut Vec<u8>>, )
Renders the part of the plasma into the provided buffer
.
You must also provide a struct implementing PixelBuffer trait.
The pitch
should contain the number of bytes of a single line in a buffer.
The boundary of rendered part should be provided by x
, y
, w
and h
arguments
in pixel coordinates starting from left/top corner.
The wrkspc
is an optional temporary memory scractchpad.
If None is provided the new memory will be allocated.
sourcepub fn import_phase_amps(&mut self, source: &[f32])
pub fn import_phase_amps(&mut self, source: &[f32])
Import the internal plasma state from a slice of 32bit floats.
sourcepub fn export_phase_amps(&self, out: &mut Vec<f32>)
pub fn export_phase_amps(&self, out: &mut Vec<f32>)
Exports the internal plasma state into the Vec of 32bit floats.
pub fn min_steps(&self) -> f32
pub fn max_steps(&self) -> f32
Trait Implementations§
impl StructuralPartialEq for Plasma
Auto Trait Implementations§
impl Freeze for Plasma
impl RefUnwindSafe for Plasma
impl Send for Plasma
impl Sync for Plasma
impl Unpin for Plasma
impl UnwindSafe for Plasma
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)