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

Methods

impl<T: Sample> BinnedWaveformRenderer<T>
[src]

[src]

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 by BinnedWaveformRenderer to render images when given a TimeRange::Seconds.
  • bin_size - The size of the bins which the min / max values will be binned into.
  • config - See WaveformConfig.

[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 this TimeRange will be rendered.
  • shape - The (width, height) of the resulting image in pixels.

[src]

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 the full_shape of img.
  • 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 this TimeRange will be rendered.
  • offsets - The (x-offset, y-offset) of the part of the img that is going to be overwritten in in pixels. Specifies the starting position to write into img.
  • shape - The (width, height) of the part of the img 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 whole img in pixels.

[src]

[src]