| 1 | use 5.14.0; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use CairoX::Sweet::Standard; | ||
| 5 | |||
| 6 | our $VERSION = '0.0108'; # VERSION | ||
| 7 | # PODNAME: CairoX::Sweet::Core::LineTo | ||
| 8 | # ABSTRACT: Draw a line_to | ||
| 9 | |||
| 10 | class CairoX::Sweet::Core::LineTo using Moose with CairoX::Sweet::Role::PathCommand { | ||
| 11 | |||
| 12 | use CairoX::Sweet::Core::Point; | ||
| 13 | |||
| 14 | has point => ( | ||
| 15 | is => 'ro', | ||
| 16 | isa => Point, | ||
| 17 | required => 1, | ||
| 18 | ); | ||
| 19 | has is_relative => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => Bool, | ||
| 22 | required => 1, | ||
| 23 | ); | ||
| 24 | |||
| 25 | around BUILDARGS($orig: $self, Num $x, Num $y, Bool :$is_relative = 0) { | ||
| 26 | my $point = CairoX::Sweet::Core::Point->new(x => $x, y => $y); | ||
| 27 | $self->$orig(is_relative => $is_relative, point => $point); | ||
| 28 | } | ||
| 29 | method out { | ||
| 30 | return $self->point->out; | ||
| 31 | } | ||
| 32 | method method { | ||
| 33 | return $self->is_relative ? 'rel_line_to' : 'line_to'; | ||
| 34 | } | ||
| 35 | method location { | ||
| 36 | return $self->point; | ||
| 37 | } | ||
| 38 | method move_location(:$x = 0, :$y = 0) { | ||
| 39 | $self->point->move(x => $x, y => $y); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | 1; | ||
| 44 | |||
| 45 | __END__ | ||
| 46 | |||
| 47 | =pod | ||
| 48 | |||
| 49 | =encoding UTF-8 | ||
| 50 | |||
| 51 | =head1 NAME | ||
| 52 | |||
| 53 | CairoX::Sweet::Core::LineTo - Draw a line_to | ||
| 54 | |||
| 55 | =head1 VERSION | ||
| 56 | |||
| 57 | Version 0.0108, released 2015-03-21. | ||
| 58 | |||
| 59 | =head1 SOURCE | ||
| 60 | |||
| 61 | L<https://github.com/Csson/p5-CairoX-Sweet> | ||
| 62 | |||
| 63 | =head1 HOMEPAGE | ||
| 64 | |||
| 65 | L<https://metacpan.org/release/CairoX-Sweet> | ||
| 66 | |||
| 67 | =head1 AUTHOR | ||
| 68 | |||
| 69 | Erik Carlsson <info@code301.com> | ||
| 70 | |||
| 71 | =head1 COPYRIGHT AND LICENSE | ||
| 72 | |||
| 73 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 74 | |||
| 75 | This is free software; you can redistribute it and/or modify it under | ||
| 76 | the same terms as the Perl 5 programming language system itself. | ||
| 77 | |||
| 78 | =cut |