NAME
Games::Chess::Coverage::Draw - Base class for visualizing chess coverage
DESCRIPTION
Represent chess coverage with a drawing module such as GD
or Imager
and plug-in rules based on board settings.
This module is the base class for specific drawing modules and is not to be used directly.
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
Object arguments computed on initialization:
image_width, image_height,
x0, y0, x1, y1
add_rule
$drawing->add_rule( $rule, \%colors );
Add a Games::Chess::Coverage::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.
Specific drawing modules such as Games::Chess::Coverage::Imager
or Games::Chess::Coverage::GD
must also define this method in order to create or allocate the necessary colors. Please see the source code of these modules for the specific details involved.
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. 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.7 2004/05/09 23:33:11 gene Exp $