NAME
Games::Chess::Coverage::Draw - Base class for visualizing chess coverage
DESCRIPTION
Visually represent chess coverage with a drawing module such as GD
or Imager
and custom plug-in rules.
This module represents the base class for specific drawing modules and should not to be used directly. Please refer to the SEE ALSO
section, below.
Please see the examples in the distribution eg/
directory.
METHODS
new
$drawing = Games::Chess::Coverage::Draw->new( %args );
Construct a fresh Games::Chess::Coverage::Draw
instance.
Here are the construction options with their default settings:
coverage => undef,
out_file => 'test',
image => undef,
image_type => 'png',
max_coord => 7,
board_size => 8,
border => 2,
left_margin => 20,
bottom_margin => 20,
square_width => 33,
square_height => 33
These object attributes are computed on initialization:
image_width, image_height,
x0, y0, x1, y1
add_rule
$drawing->add_rule( $rule, \%colors_etc );
Add a drawing 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.
Specific drawing modules, that use Imager
or GD
for instance, must also define this method in order to create or allocate the necessary colors for that module.
draw
$img = $drawing->draw;
Apply the defined drawing rules to the image.
SEE ALSO
Games::Chess::Coverage::Imager
TO DO
Make this an XBoard engine. Draw a transparent image over the board itself.
Describe the meta-API of user defined pieces, rules and colorings.
Figure out if ChessVision already does this all better and then assimilate its brains.
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2004, Gene Boggs
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.