104
100
sub draw_polygon {
106
102
if( fetch_conf("debug_validate") ) {
107
%params = validate(@_,{
109
color => fetch_conf("default_color") || $default_color,
103
%params = validate(@_,{
105
color => fetch_conf("default_color") || $default_color,
116
$params{color} ||= fetch_conf("default_color") || $default_color;
112
$params{color} ||= fetch_conf("default_color") || $default_color;
119
115
printdebug_group("png","polygon",map {@$_} $params{polygon}->vertices);
121
117
if($params{pattern}) {
122
my ($color_idx,$tile);
123
if ($params{fill_color} ) {
124
$tile = Circos::fetch_colored_fill_pattern($params{pattern},$params{fill_color});
125
} elsif ($params{pattern}) {
126
$tile = Circos::fetch_fill_pattern($params{pattern});
130
$IM->filledPolygon($params{polygon},gdTiled);
118
my ($color_idx,$tile);
119
if ($params{fill_color} ) {
120
$tile = Circos::fetch_colored_fill_pattern($params{pattern},$params{fill_color});
121
} elsif ($params{pattern}) {
122
$tile = Circos::fetch_fill_pattern($params{pattern});
126
$IM->filledPolygon($params{polygon},gdTiled);
132
128
} elsif ($params{fill_color} && ref $params{polygon} eq "GD::Polygon") {
133
my $color_obj = aa_color( $params{fill_color}, $IM, $COLORS );
134
$IM->filledPolygon($params{polygon},$color_obj);
129
my $color_obj = aa_color( $params{fill_color}, $IM, $COLORS );
130
$IM->filledPolygon($params{polygon},$color_obj);
137
132
stroke($params{thickness},$params{color},"polydraw",$params{polygon});
166
161
if( fetch_conf("debug_validate") ) {
167
162
%params = validate(@_,{
168
points => { type => ARRAYREF },
169
color => { default => fetch_conf("default_color") || $default_color },
170
thickness => { default => 1 },
163
points => { type => ARRAYREF },
164
color => { default => fetch_conf("default_color") || $default_color },
165
thickness => { default => 1 },
174
$params{color} ||= fetch_conf("default_color") || $default_color;
175
$params{thickness} ||= 1;
169
$params{color} ||= fetch_conf("default_color") || $default_color;
170
$params{thickness} ||= 1;
178
173
if ( $params{thickness} > 100 ) {
179
fatal_error("links","too_thick",$params{thickness});
174
fatal_error("links","too_thick",$params{thickness});
180
175
} elsif ( $params{thickness} < 1 ) {
181
fatal_error("links","too_thin",$params{thickness});
176
fatal_error("links","too_thin",$params{thickness});
184
179
# In the current implementation of gd (2.0.35) antialiasing is
185
180
# incompatible with thick lines and transparency. Thus, antialiased lines
186
181
# are available only when thickness=1 and the color has no alpha channel.
188
183
printdebug_group("link","thickness",$params{thickness},"color",$params{color});
190
185
my $bezier_poly_line = GD::Polyline->new();
191
186
for my $point ( @{$params{points}} ) {
192
$bezier_poly_line->addPt(@$point);
187
$bezier_poly_line->addPt(@$point);
195
189
stroke($params{thickness},$params{color},"polydraw",$bezier_poly_line);
198
192
# applies a stroke to a GD object drawn by function $fn
199
193
# added on island of Capri :)
201
my ($st,$sc,$fn,@args) = @_;
204
$sc ||= fetch_conf("default_color") || $default_color;
205
if(fetch_conf("anti_aliasing") && $st == 1 && rgb_color_opacity($sc) == 1) {
206
$IM->setAntiAliased(fetch_color($sc));
207
$color_obj = gdAntiAliased;
209
$IM->setThickness($st) if $st > 1;
210
$color_obj = fetch_color($sc);
212
$IM->$fn(@args,$color_obj);
213
$IM->setThickness(1) if $st > 1;
195
my ($st,$sc,$fn,@args) = @_;
198
$sc ||= fetch_conf("default_color") || $default_color;
200
if(fetch_conf("anti_aliasing") && $st == 1 && rgb_color_opacity($sc) == 1) {
201
$IM->setAntiAliased(fetch_color($sc));
202
$color_obj = gdAntiAliased;
204
# When the element is thicker than round_brush_min_thickness, use a round brush instead
205
# of the default square one. This fixes jaggies on thick links.
206
$buse = fetch_conf("round_brush_use") && $st >= fetch_conf("round_brush_min_thickness");
208
($b,$bc) = Circos::fetch_brush($st,$st,$sc);
211
$IM->setThickness($st) if $st > 1;
213
$color_obj = fetch_color($sc);
216
$IM->$fn(@args,gdBrushed);
218
$IM->$fn(@args,$color_obj);
219
$IM->setThickness(1) if $st > 1;