X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FClip.pm;h=1b61b4db0f996ddf3bc2caff61a0a598920713c9;hb=b8f42942311854cb0ef8a3e34c0145846639cd2e;hp=3f5454e301c0883f44c4888e2365fd44ec3bed36;hpb=92147217516a40b35ca00c8e08939e8aa5478426;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Clip.pm b/lib/LaTeX/TikZ/Mod/Clip.pm index 3f5454e..1b61b4d 100644 --- a/lib/LaTeX/TikZ/Mod/Clip.pm +++ b/lib/LaTeX/TikZ/Mod/Clip.pm @@ -9,28 +9,43 @@ LaTeX::TikZ::Mod::Clip - A modifier that clips sequences with a path. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; 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', - does => 'LaTeX::TikZ::Set::Op', + does => 'LaTeX::TikZ::Set::Path', required => 1, ); @@ -40,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; @@ -115,7 +140,7 @@ my @handlers = ( [ 'LaTeX::TikZ::Set::Circle' => $cover_circle ], ); -sub cover { +sub covers { my ($old, $new) = map $_->clip, @_[0, 1]; for (@handlers) { @@ -127,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) = @_; @@ -138,11 +171,13 @@ sub apply { ) } -use LaTeX::TikZ::Interface 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 { @@ -153,6 +188,10 @@ LaTeX::TikZ::Functor->default_rule( __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L.