diff options
-rw-r--r-- | lib/GridFiller/Result/Pango.pm | 15 | ||||
-rw-r--r-- | script/qr-color.pl | 1 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/GridFiller/Result/Pango.pm b/lib/GridFiller/Result/Pango.pm index 34b3401..442aa06 100644 --- a/lib/GridFiller/Result/Pango.pm +++ b/lib/GridFiller/Result/Pango.pm @@ -19,6 +19,12 @@ has cell_size => ( default => 20, ); +has border => ( + isa => Int, + is => 'rw', + default => 2, +); + has _width => ( isa => Int, is => 'ro', @@ -29,7 +35,7 @@ has _width => ( sub _build__width { my ($self) = @_; - return $self->cell_size * @{$self->source_grid->[0]}; + return $self->cell_size * (2*$self->border + @{$self->source_grid->[0]}); } has _height => ( @@ -42,7 +48,7 @@ has _height => ( sub _build__height { my ($self) = @_; - return $self->cell_size * @{$self->source_grid}; + return $self->cell_size * (2*$self->border + @{$self->source_grid}); } has _cairo_s => ( @@ -129,9 +135,9 @@ sub _put_squares { $cr->set_source_rgb(1,1,1); $cr->fill; - my $y=0; + my $y=$self->border*$size; for my $row (@{$self->source_grid}) { - my $x=0; + my $x=$self->border*$size; for my $cell (@$row) { if ($cell eq '*') { $cr->rectangle($x,$y,$size,$size); @@ -227,6 +233,7 @@ sub place_word_at { my @colour = $self->colour_for_string($word,$x,$y,$dir); my $size = $self->cell_size; my $cr = $self->_cairo_c; + $x+=$self->border;$y+=$self->border; $x*=$size;$y*=$size; my ($w_adjustment,$h_adjustment) = $self->_center_adj($p,$space); diff --git a/script/qr-color.pl b/script/qr-color.pl index c665371..5942fca 100644 --- a/script/qr-color.pl +++ b/script/qr-color.pl @@ -34,6 +34,7 @@ my $filler=GridFiller->new({ my $result = GridFiller::Result::Pango->new({ source_grid => $filler->grid, + cell_size => 40, ( @ARGV ? (font_description => $ARGV[0]) : () ), }); |