X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FClip.pm;h=f9d90228d96018431886455545323fc1bc7d2cd8;hb=0f9d7c1a2d11bc7001fe450cb2086e67c13a39e9;hp=5fdac3d55431eecb7a474378df17eedf72a3d86e;hpb=e8f0879ade07eed4f58cd52c0771f4e1ecc90b09;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Clip.pm b/lib/LaTeX/TikZ/Mod/Clip.pm index 5fdac3d..f9d9022 100644 --- a/lib/LaTeX/TikZ/Mod/Clip.pm +++ b/lib/LaTeX/TikZ/Mod/Clip.pm @@ -20,15 +20,32 @@ use Sub::Name (); use LaTeX::TikZ::Formatter; use LaTeX::TikZ::Mod::Formatted; +use LaTeX::TikZ::Interface; +use LaTeX::TikZ::Functor; + use LaTeX::TikZ::Tools; use Any::Moose; +=head1 RELATIONSHIPS + +This class consumes the L role, and as such implements the L, L, L and L methods. + +=cut + with 'LaTeX::TikZ::Mod'; +=head1 ATTRIBUTES + +=head2 C + +The path that specifies the clipped area. + +=cut + has clip => ( is => 'ro', - isa => 'LaTeX::TikZ::Set::Op', + does => 'LaTeX::TikZ::Set::Op', required => 1, ); @@ -38,8 +55,18 @@ my $default_formatter = LaTeX::TikZ::Formatter->new( scale => 1, ); +=head1 METHODS + +=head2 C + +=cut + sub tag { ref $_[0] } +=head2 C + +=cut + my $get_tc = do { my %tc; @@ -125,8 +152,16 @@ sub cover { $old->path($default_formatter) eq $new->path($default_formatter); } +=head2 C + +=cut + sub declare { } +=head2 C + +=cut + sub apply { my ($self) = @_; @@ -136,14 +171,27 @@ sub apply { ) } -use LaTeX::TikZ::API clip => sub { - shift; +LaTeX::TikZ::Interface->register( + clip => sub { + shift; - __PACKAGE__->new(clip => $_[0]); -}; + __PACKAGE__->new(clip => $_[0]); + }, +); + +LaTeX::TikZ::Functor->default_rule( + (__PACKAGE__) => sub { + my ($functor, $mod, @args) = @_; + $mod->new(clip => $mod->clip->$functor(@args)) + } +); __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L.