Struct waveform::binned::BinnedWaveformRenderer
[−]
[src]
pub struct BinnedWaveformRenderer<T: Sample> { pub config: WaveformConfig, // some fields omitted }
A fast "binned" waveform renderer.
Minimum / maximum amplitude values are binned to reduce calculation and memory usage.
Fields
config: WaveformConfig
Methods
impl<T: Sample> BinnedWaveformRenderer<T>
[src]
fn new(
samples: &SampleSequence<T>,
bin_size: usize,
config: WaveformConfig
) -> Result<BinnedWaveformRenderer<T>, Box<Error>>
[src]
samples: &SampleSequence<T>,
bin_size: usize,
config: WaveformConfig
) -> Result<BinnedWaveformRenderer<T>, Box<Error>>
The constructor.
Arguments
samples
- The samples that will be used to calculate binned min / max values. It must also contain the sample rate that is used byBinnedWaveformRenderer
to render images when given aTimeRange::Seconds
.bin_size
- The size of the bins which the min / max values will be binned into.config
- SeeWaveformConfig
.
fn render_vec(&self, range: TimeRange, shape: (usize, usize)) -> Option<Vec<u8>>
[src]
Renders an image as a Vec<u8>
.
None
will be returned if the area of the specified shape
is equal to zero.
Arguments
range
- The samples within thisTimeRange
will be rendered.shape
- The(width, height)
of the resulting image in pixels.
fn render_write(
&self,
range: TimeRange,
offsets: (usize, usize),
shape: (usize, usize),
img: &mut [u8],
full_shape: (usize, usize)
) -> Result<(), Box<Error>>
[src]
&self,
range: TimeRange,
offsets: (usize, usize),
shape: (usize, usize),
img: &mut [u8],
full_shape: (usize, usize)
) -> Result<(), Box<Error>>
Writes the image into a mutable reference to a slice.
It will raise an error if
- the area of the specified
shape
is equal to zero. - either the width or height of the
shape
exceeds that of thefull_shape
ofimg
. - the length of
img
is not long enough to contain the result.(offsets.0 + shape.0) * (offsets.1 + shape.1) * (Bytes per pixel) <= img.len()
must be satisfied.
Arguments
range
- The samples within thisTimeRange
will be rendered.offsets
- The(x-offset, y-offset)
of the part of theimg
that is going to be overwritten in in pixels. Specifies the starting position to write intoimg
.shape
- The(width, height)
of the part of theimg
that is going to be overwritten in pixels.img
- A mutable reference to the slice to write the result into.full_shape
- The(width, height)
of the wholeimg
in pixels.