1
package Bio::Graphics::Glyph::tic_tac_toe;
4
use base qw(Bio::Graphics::Glyph::generic);
19
my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
21
my $fg = $self->fgcolor;
23
my $size = defined $self->option('size') ? $self->option('size') : $self->default_size();
25
my $mode= defined $self->option('mode') ? $self->option('mode') : $self->default_mode();
27
my $midY = ($y1+$y2)/2;
29
for (my $i=0; $i<($x2-$x1)/$size; $i++)
31
my $start = $x1+$i*$size;
32
my $end = $x1+($i+1)*$size;
33
if ($mode eq "x" || ($mode eq "xo" && $i%2==0))
35
$gd->line($start, $midY-$size/2, $end, $midY+$size/2, $fg);
36
$gd->line($end, $midY-$size/2, $start, $midY+$size/2, $fg);
38
elsif ($mode eq "o" || ($mode eq "xo" && $i%2==1))
40
$gd->ellipse(($start+$end)/2, $midY, $size, $size, $fg);
51
Bio::Graphics::Glyph::tic_tac_toe - The "tic-tac-toe" glyph
55
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
59
This glyph draws a sequence of either 'xxx', 'ooo' or 'xoxo',
60
depending on the value of 'mode'.
64
In addition to the common options, the following glyph-specific
65
options are recognized:
67
Option Description Default
68
------ ----------- -------
70
-mode One of 'x', 'o', or 'xo'. 'x'
72
-size Size of either 'x' or 'o' 10
80
L<Bio::Graphics::Panel>,
81
L<Bio::Graphics::Glyph>,
82
L<Bio::Graphics::Glyph::arrow>,
83
L<Bio::Graphics::Glyph::cds>,
84
L<Bio::Graphics::Glyph::crossbox>,
85
L<Bio::Graphics::Glyph::diamond>,
86
L<Bio::Graphics::Glyph::dna>,
87
L<Bio::Graphics::Glyph::dot>,
88
L<Bio::Graphics::Glyph::ellipse>,
89
L<Bio::Graphics::Glyph::extending_arrow>,
90
L<Bio::Graphics::Glyph::generic>,
91
L<Bio::Graphics::Glyph::graded_segments>,
92
L<Bio::Graphics::Glyph::heterogeneous_segments>,
93
L<Bio::Graphics::Glyph::line>,
94
L<Bio::Graphics::Glyph::pinsertion>,
95
L<Bio::Graphics::Glyph::primers>,
96
L<Bio::Graphics::Glyph::rndrect>,
97
L<Bio::Graphics::Glyph::segments>,
98
L<Bio::Graphics::Glyph::ruler_arrow>,
99
L<Bio::Graphics::Glyph::toomany>,
100
L<Bio::Graphics::Glyph::transcript>,
101
L<Bio::Graphics::Glyph::transcript2>,
102
L<Bio::Graphics::Glyph::translation>,
103
L<Bio::Graphics::Glyph::triangle>,
112
Vsevolod (Simon) Ilyushchenko E<lt>simonf@cshl.eduE<gt>.
114
Copyright (c) 2004 Cold Spring Harbor Laboratory
116
This library is free software; you can redistribute it and/or modify
117
it under the same terms as Perl itself. See DISCLAIMER.txt for
118
disclaimers of warranty.