Scroll to navigation

Prima::Drawable::Wave(3) User Contributed Perl Documentation Prima::Drawable::Wave(3)

NAME

Prima::Drawable::Wave - plot wavy lines

DESCRIPTION

Collection of routines for generating and plotting wavy lines. Can render triangle, square, and spline effects.

SYNOPSIS

  use Prima::Drawable::Wave;
  $canvas->antialias(1);
  my $points = Prima::Drawable::Wave::square(
     [20, 100, 100, 60, 180, 120, 270, 80],
     4, 20,
  );
  $canvas->lineWidth(.5);
  $canvas->spline( $canvas-> render_spline($points) );
  $canvas->font->size(20);
  $canvas->text_out('Hello world', 70, 80);
  $canvas->lineWidth($canvas->font->underlineThickness);
  $canvas->alpha(128);
  Prima::Drawable::Wave::underline($canvas, 'Hello world', 70, 80, effect => 'triangle');

API

underline CANVAS, TEXT, X, Y, %OPT

Given TEXT, draws a way line in the X and Y coordinates. Uses $OPT{effect} or 'wave' as the line effect, and $OPT{precision} for eventual spline precision.

Can only draw a single wavy underline; check "draw_underline" in Prima::Drawable for wavy effects with smart underline that respect font glyphs that cross the descent line.

polyline EFFECT, VERTICES, AMPLITUDE, WAVENELNGTH, @OPTIONS

Converts VERTICES to another set of vertices for generation of a wavy line. The result can directly be passed to the "Prima::Drawable::polyline" method.

Optional AMPLITUDE and WAVENELNGTH manage the effect settings.

Eventual @OPTIONS are passed to the effect function, see below.

square VERTICES, AMPLITUDE, WAVENELNGTH

Creates a square wave line

triangle VERTICES, AMPLITUDE, WAVENELNGTH

Creates a triangle wave line

spline VERTICES, AMPLITUDE, WAVENELNGTH, PRECISION

Creates a spline wave line

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima::Drawable::Path

2026-09-10 perl v5.44.0