Music::Image::Chord - Perl extension for generating guitar tab chords


Music-Image-Chord documentation  | view source Contained in the Music-Image-Chord distribution.

Index


NAME

Top

Music::Image::Chord - Perl extension for generating guitar tab chords

SYNOPSIS

Top

  use Music::Image::Chord;
  $image = new Music::Image::Chord();
  $old_font = $image->font('/path/to/my/TrueType/font.ttf');
  $old_file = $image->file('/path/to/file/to/save.png');
  $image->draw(name => 'D'); # Write the actual file.

DESCRIPTION

Top

Image::Chord is a simple package for creating images of guitar chords in any format that the Imager module can produce.

The object's API is as follows:

new Image::Chord()

Creates and returns a new Image::Chord object.

bar_thickness

Returns and optionally sets the thickness of the fret bar. Only used if on the first fret (which is the default).

bounds

Returns and optionally sets the image boundaries. It accepts several formats:

 $image->bounds($width, $height);
 $image->bounds(width=>$wid, height=>$hgt);
 $image->bounds(xmin=>$xmin, xmax=>$xmax, yMIN=>$ymin, YMax=>$ymax);

crop_width

Returns and optionally sets the width/height of the crop marks on the image. If this value is not set or is <= 0, then crop marks will not be drawn.

 $image->crop_width(5); # Crop marks will be 5 pixels wide.
 print $image->crop_width(); # Display the current crop mark width.

debug

Returns and optionally sets the Imager debugging flag.

 $image->debug(1); # Set debugging
 print $image->debug(); # Get the current debugging value

font

Returns and optionally sets the font used to render the chord's title.

 $image->font('/home/jgoff/Bach.ttf'); # Display in the Bach TrueType font
 $foo = $image->font(); # Assign $foo to the image's font

file

Returns and optionally sets the file name to save the rendered image to. It also reads the extension of the file to determine how to save the image.

 $image->file('/home/jgoff/chord.png');

fret

Returns and optionally sets the beginning fret in the image. Defaults to 1.

 $image->fret(5);
 print $image->fret(); # prints the current fret setting.

draw([optional named parameters])

Renders the chord described into the appropriate file. Optional named parameters are:

  name - The name of the chord
  fret - Beginning fret
  barres - Chord barres, not implemented yet.
  chord - If the chord isn't represented in the list, describe it like 'xx0232'.

$image->draw( name => 'D' ); # Draw a D chord

grid

Returns and optionally sets the grid coordinates. X and Y are the UL corner of the grid, and w and h control (for the moment, this will change) the inter-string and inter-fret spacing.

 $image->grid($x,$y,$w,$h); # Set explicitly
 $image->grid(x=>$x,y=>$y,w=>$w,h=>$h); # Set through named parameters.

SEE ALSO

Top

Imager perl(1).

AUTHOR

Top

Jeffrey Goff, <jgoff@cpan.org<gt> Inspiration by #perl

COPYRIGHT AND LICENSE

Top


Music-Image-Chord documentation  | view source Contained in the Music-Image-Chord distribution.