CairoX-Sweet

 view release on metacpan or  search on metacpan

lib/CairoX/Sweet.pm  view on Meta::CPAN

    my %args = @_;

    my $text = $args{'text'};
    my $x = $args{'x'};
    my $y = $args{'y'};
    my $color = shift;
    $color = Color->check($color) ? $color : Color->coerce($color);
    my $font_face = $args{'font_face'} || [];
    my $font_size = shift;
    my $slant = $args{'slant'} || 'normal'; # normal italic oblique
    my $weight = $args{'weight'} || 'normal'; # normal bold


    $self->c->select_font_face(@{ $font_face }, $slant, $weight) if scalar @$font_face;
    $self->c->set_font_size($font_size) if defined $font_size;
    $self->c->set_source_rgb($color->color) if defined $color;
    $self->c->move_to($x, $y)               if defined $x && defined $y;

    $self->c->show_text($text);
    $self->c->fill;

lib/CairoX/Sweet.pm  view on Meta::CPAN

=head2 add_text()

Adds a string to the C<cairo> object. Takes only named parameters.

    $c->add_text( text => "The text to add",
                  color => '#444444',
                  x => 37,
                  y => 115,
                  font_face => ['courier'],
                  font_size => 13
                  weight => 'bold',
    );

C<text => 'the text'>

String. The only required parameter. The text to add.

C<x>

C<y>

lib/CairoX/Sweet.pm  view on Meta::CPAN

C<font_face>

An array reference of font faces. There is no list of available font faces.

C<font_size>

Number. The size of the text. Default is C<10>.

C<weight>

One of C<normal> or C<bold>.

C<slant>

One of C<normal>, C<italic> or C<oblique>.

=head2 c()

Returns the L<Cairo> object itself.

    $c->c->set_source_rgb(0.4, 0.3, 0.2);



( run in 2.014 seconds using v1.01-cache-2.11-cpan-5dc5da66d9d )