diff --git a/lib/SDLx/Surface.pm b/lib/SDLx/Surface.pm index fa3f0498..a2e9ce6e 100644 --- a/lib/SDLx/Surface.pm +++ b/lib/SDLx/Surface.pm @@ -337,7 +337,12 @@ sub draw_polygon_filled { } sub draw_arc { - my ( $self, $vector, $radius, $start, $end, $color ) = @_; + my ( $self, $center, $radius, $start, $end, $color ) = @_; + + Carp::cluck "Center needs to be an array of format [x,y]" unless ( ref $center eq 'ARRAY' && scalar @$center == 2 ); + $color = SDLx::Validate::num_rgba($color); + + SDL::GFX::Primitives::arc_color( $self, @$center, $radius, $start, $end, $color ); return $self; } @@ -374,6 +379,13 @@ sub draw_ellipse_filled { sub draw_bezier { my ( $self, $vector, $smooth, $color ) = @_; + $color = SDLx::Validate::num_rgba($color); + + my @vx = map { $_->[0] } @$vector; + my @vy = map { $_->[1] } @$vector; + SDL::GFX::Primitives::bezier_color( $self, \@vx, \@vy, scalar @$vector, $smooth, $color ); + + return $self; } sub draw_gfx_text { diff --git a/lib/pods/SDLx/Surface.pod b/lib/pods/SDLx/Surface.pod index dfd1ccc5..348e6230 100644 --- a/lib/pods/SDLx/Surface.pod +++ b/lib/pods/SDLx/Surface.pod @@ -217,6 +217,15 @@ Draws an B polygon with vertices C<($xN,$yN)> and $color. Antialias is turned on automatically. Returns $self +=head2 draw_arc + + $sdlx_surface->draw_arc( [ $x, $y ], $radius, $start, $end, $color ); + +Draws an arc around C<($x,$y)> with $radius, $start radius, $end radius +and $color. + +Returns $self + =head2 draw_ellipse $sdlx_surface->draw_ellipse( [ $x, $y ], $rx, $ry, $color ); @@ -237,6 +246,16 @@ Antialias is turned on automatically. Returns $self +=head2 draw_bezier + + $sdlx_surface->draw_bezier( [ [$x1, $y1], [$x2, $y2], [$x3, y3], ... ], $s, $color ); + +Draws a bezier curve of points C<($xN,$yN)> using $s steps for +interpolation and $color. +Antialias is turned on automatically. + +Returns $self + =head2 draw_gfx_text Draw text using gfx (not pretty but fast) at give vector, color.