Optimize the generation of the waveform and add the possibility to use a
linear gradient to fill the waveform.