X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FPattern%2FDots.pm;h=208c3b39158d0be577b05136d6599d27ba404858;hb=062ab95259610ce39ace60365b659d6113420ce7;hp=3fea8a6b08bd863e5b9384f64b05e83eb788dd1c;hpb=e8f0879ade07eed4f58cd52c0771f4e1ecc90b09;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm b/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm index 3fea8a6..208c3b3 100644 --- a/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm +++ b/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm @@ -9,28 +9,45 @@ LaTeX::TikZ::Mod::Pattern::Dots - A dotted pattern modifier. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; use Sub::Name (); -use Any::Moose; +use Mouse; +use Mouse::Util::TypeConstraints; + +=head1 RELATIONSHIPS + +This class inherits the L class and its L, L, L and L methods. + +=cut extends 'LaTeX::TikZ::Mod::Pattern'; +=head1 ATTRIBUTES + +=head2 C + +=cut + has 'dot_width' => ( is => 'ro', - isa => 'Int', + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), default => 1, ); +=head2 C + +=cut + has 'space_width' => ( is => 'ro', - isa => 'Int', - default => 1, + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), + default => 10, ); my $W = Sub::Name::subname('WIDTH' => sub { sprintf '#WIDTH=%0.1f#', @_ }); @@ -53,21 +70,21 @@ my $forge_template = Sub::Name::subname('forge_template' => sub { $center = "\\pgfqpoint{$half_width}{$half_width}"; $tile_size = "\\pgfqpoint{$width}{$width}"; - <<" PATTERN"; -\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{% - \\pgfpathcircle{$center}{$dot_width} - \\pgfusepath{fill} -} - PATTERN + return [ + "\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{", + "\\pgfpathcircle{$center}{$dot_width}", + "\\pgfusepath{fill}", + '}', + ]; }); around 'BUILDARGS' => sub { - my ($orig, $class, %args); + my ($orig, $class, %args) = @_; confess('Can\'t specify an explicit template for a '. __PACKAGE__ .' pattern') if exists $args{template}; - my @params = qw/dot_width space_width/; + my @params = qw; my $meta = $class->meta; for (@params) { @@ -83,6 +100,10 @@ around 'BUILDARGS' => sub { __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L. @@ -102,7 +123,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2010 Vincent Pit, all rights reserved. +Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.