NAME

Games::Chess::Coverage::GD::Draw - Visualize chess coverage

SYNOPSIS

use Games::Chess::Coverage::GD::Draw;

$drawing = Games::Chess::Coverage::GD::Draw->new(
    coverage   => $coverage_object,
    out_file   => 'eg/foo',
    image_type => 'png',
    width      => 40,
    height     => 40,
    grid       => 0,
    border     => 0,
    letters    => 1,
);

$drawing->add_rule( $rule, \%colors );

$img = $drawing->draw;

$drawing->board_to_file;

DESCRIPTION

Represent chess coverage with the GD drawing module and plug-in rules based on board settings.

Please see the examples in the distribution eg/ directory.

METHODS

new

$drawing = Games::Chess::Coverage::GD::Draw->new( %args );

Construct a fresh Games::Chess::Coverage::GD::Draw instance.

add_rule

$drawing->add_rule( $rule, \%colors );

Add a Games::Chess::Coverage::GD::Draw plugin where the rule is a package containing a subroutine named for itself. The rules are kept in an ordered list so that they can be applied in a determined sequence.

draw

$img = $drawing->draw;

Return a GD image object with the plug-in rules applied.

board_to_file

$drawing->board_to_file;

Write the GD image object to a file based on the out_file and image_type settings.

SEE ALSO

The source code of this module.

Games::Chess

Games::Chess::Coverage

TO DO

Allow hex number color specifications.

Make this an XBoard engine. Maybe draw a transparent image over the board itself.

Describe the meta-API. That is user defined pieces, rules and colorings.

Figure out if ChessVision already does this all better and then assimilate it's brains.

CVS

$Id: Draw.pm,v 1.21 2004/04/11 04:22:33 gene Exp $