Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

custom merge level for icons

  • Loading branch information...
commit 62edf0c0de482a4ffd5be5a5a943ad42b40ab045 1 parent 4649b28
Dobrica Pavlinušić authored

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. +10 5 tiles.pl
15 tiles.pl
@@ -58,11 +58,16 @@
58 58
59 59 sub get_icon {
60 60 my $zoom = shift;
  61 +
  62 + # Calculate which icon to use based on zoom...
61 63 $imicon = GD::Image->newFromPng( $zoom > 7 ? $icon2 : $icon1 ) ;
62   - # Calculate which icon to use based on zoom...
  64 + my $merge = 90;
63 65
64 66 my $custom_icon = "$name/icons/$zoom.png";
65   - $imicon = GD::Image->newFromPng( $custom_icon ) if -e $custom_icon;
  67 + if ( -e $custom_icon ) {
  68 + $imicon = GD::Image->newFromPng( $custom_icon );
  69 + $merge = 50;
  70 + }
66 71
67 72 my $xiconpix = $imicon->width;
68 73 my $yiconpix = $imicon->height;
@@ -71,7 +76,7 @@ sub get_icon {
71 76 my $xiconoff = $xiconpix / 2;
72 77 my $yiconoff = $yiconpix / 2;
73 78
74   - return ( $xiconpix, $yiconpix, $xiconoff, $yiconoff );
  79 + return ( $xiconpix, $yiconpix, $xiconoff, $yiconoff, $merge );
75 80 }
76 81
77 82 # Relations:
@@ -185,7 +190,7 @@ sub get_icon {
185 190
186 191 $im->setThickness(1) ;
187 192
188   - my ( $xiconpix, $yiconpix, $xiconoff, $yiconoff ) = get_icon $zoom;
  193 + my ( $xiconpix, $yiconpix, $xiconoff, $yiconoff, $merge ) = get_icon $zoom;
189 194
190 195 $sti = $dbh->prepare("select latpix,lngpix from gvp_world_tiles where zoom = $zoom and tilex = $tilex and tiley = $tiley") ;
191 196
@@ -196,7 +201,7 @@ sub get_icon {
196 201 $ix = $lngpix - $left - $xiconoff ; # Remove half image size
197 202 $iy = $latpix - $top - $yiconoff ; # Remove half image size
198 203 # $im->copy($imicon,$ix,$iy,0,0,$xiconpix,$yiconpix) ;
199   - $im->copyMerge($imicon,$ix,$iy,0,0,$xiconpix,$yiconpix,50) ;
  204 + $im->copyMerge($imicon,$ix,$iy,0,0,$xiconpix,$yiconpix,$merge) ;
200 205 }
201 206
202 207 open(my $PNG, '>', $file) || die "$file: $!";

0 comments on commit 62edf0c

Please sign in to comment.
Something went wrong with that request. Please try again.