pods::...itives(3pm)
π NAME π
pods::...itives(3pm) is the manual page, and the module is SDL::GFX::Primitives β basic drawing functions. Thatβs the whole vibe, bestie: little drawing primitives for your SDL surface. π
π CATEGORY π
GFX
β¨ DESCRIPTION β¨
okay so every single function here takes an SDL::Surface object as its first parameter. That surface can be a brand-new surface that gets blitted afterward, a surface you got from SDL::Video::set_video_mode, or an SDLx::App. No cap. β¨
The color values for the _color functions are 0xRRGGBBAA (32bit), even if the surface uses e. g. 8bit colors. Yes, even then. The alpha is literally in there. π
ποΈ METHODS ποΈ
pixel πΈ
int SDL::GFX::Primitives::pixel_color( $surface, $x, $y, $color );
int SDL::GFX::Primitives::pixel_RGBA( $surface, $x, $y, $r, $g, $b, $a );
Draws a pixel at point x/$y. You can pass the color by 0xRRGGBBAA or by passing 4 values. One for red, green, blue and alpha. π
use SDL;
use SDL::Video;
use SDL::Surface;
use SDL::GFX::Primitives;
my $surface = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
SDL::GFX::Primitives::pixel_color($surface, 2, 2, 0xFF0000FF); # red pixel
SDL::GFX::Primitives::pixel_RGBA( $surface, 4, 4, 0x00, 0xFF, 0x00, 0xFF); # green pixel
hline π«
int SDL::GFX::Primitives::hline_color( $surface, $x1, $x2, $y, $color );
int SDL::GFX::Primitives::hline_RGBA( $surface, $x1, $x2, $y, $r, $g, $b, $a );
Draws a line horizontally from $x1/$y to $x2/$y.
vline π
int SDL::GFX::Primitives::vline_color( $surface, $x, $y1, $y2, $color );
int SDL::GFX::Primitives::vline_RGBA( $surface, $x, $y1, $y2, $r, $g, $b, $a );
Draws a line vertically from $x/$y1 to $x/$y2.
rectangle π
int SDL::GFX::Primitives::rectangle_color( $surface, $x1, $y1, $x2, $y2, $color );
int SDL::GFX::Primitives::rectangle_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a );
Draws a rectangle. Upper left edge will be at $x1/$y1 and lower right at $x2/$y. The colored border has a width of 1 pixel.
box π
int SDL::GFX::Primitives::box_color( $surface, $x1, $y1, $x2, $y2, $color );
int SDL::GFX::Primitives::box_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a );
Draws a filled rectangle.
line π¦
int SDL::GFX::Primitives::line_color( $surface, $x1, $y1, $x2, $y2, $color );
int SDL::GFX::Primitives::line_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a );
Draws a free line from $x1/$y1 to $x2/$y.
aaline β¨
int SDL::GFX::Primitives::aaline_color( $surface, $x1, $y1, $x2, $y2, $color );
int SDL::GFX::Primitives::aaline_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a );
Draws a free line from $x1/$y1 to $x2/$y. This line is anti aliased.
circle π
int SDL::GFX::Primitives::circle_color( $surface, $x, $y, $r, $color );
int SDL::GFX::Primitives::circle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a );
arc π
int SDL::GFX::Primitives::arc_color( $surface, $x, $y, $r, $start, $end, $color );
int SDL::GFX::Primitives::arc_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a );
Note: You need lib SDL_gfx 2.0.17 or greater for this function.
aacircle π
int SDL::GFX::Primitives::aacircle_color( $surface, $x, $y, $r, $color );
int SDL::GFX::Primitives::aacircle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a );
Note: You need lib SDL_gfx 2.0.17 or greater for this function.
filled_circle π«Ά
int SDL::GFX::Primitives::filled_circle_color( $surface, $x, $y, $r, $color );
int SDL::GFX::Primitives::filled_circle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a );
ellipse πΈ
int SDL::GFX::Primitives::ellipse_color( $surface, $x, $y, $rx, $ry, $color );
int SDL::GFX::Primitives::ellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a );
aaellipse π«
int SDL::GFX::Primitives::aaellipse_color( $surface, $xc, $yc, $rx, $ry, $color );
int SDL::GFX::Primitives::aaellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a );
filled_ellipse π
int SDL::GFX::Primitives::filled_ellipse_color( $surface, $x, $y, $rx, $ry, $color );
int SDL::GFX::Primitives::filled_ellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a );
pie π₯§
int SDL::GFX::Primitives::pie_color( $surface, $x, $y, $rad, $start, $end, $color );
int SDL::GFX::Primitives::pie_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a );
This draws an opened pie. $start and $end are degree values. 0 is at right, 90 at bottom, 180 at left and 270 degrees at top.
filled_pie π°
int SDL::GFX::Primitives::filled_pie_color( $surface, $x, $y, $rad, $start, $end, $color );
int SDL::GFX::Primitives::filled_pie_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a );
trigon πΊ
int SDL::GFX::Primitives::trigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color );
int SDL::GFX::Primitives::trigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a );
aatrigon β¨
int SDL::GFX::Primitives::aatrigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color );
int SDL::GFX::Primitives::aatrigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a );
filled_trigon π₯
int SDL::GFX::Primitives::filled_trigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color );
int SDL::GFX::Primitives::filled_trigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a );
polygon π
int SDL::GFX::Primitives::polygon_color( $surface, $vx, $vy, $n, $color );
int SDL::GFX::Primitives::polygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a );
Example:
SDL::GFX::Primitives::polygon_color($display, [262, 266, 264, 266, 262], [243, 243, 245, 247, 247], 5, 0xFF0000FF);
aapolygon π
int SDL::GFX::Primitives::aapolygon_color( $surface, $vx, $vy, $n, $color );
int SDL::GFX::Primitives::aapolygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a );
filled_polygon π
int SDL::GFX::Primitives::filled_polygon_color( $surface, $vx, $vy, $n, $color );
int SDL::GFX::Primitives::filled_polygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a );
textured_polygon π§
int SDL::GFX::Primitives::textured_polygon( $surface, $vx, $vy, $n, $texture, $texture_dx, $texture_dy );
filled_polygon_MT β
int SDL::GFX::Primitives::filled_polygon_color_MT( $surface, $vx, $vy, $n, $color, $polyInts, $polyAllocated );
int SDL::GFX::Primitives::filled_polygon_RGBA_MT( $surface, $vx, $vy, $n, $r, $g, $b, $a, $polyInts, $polyAllocated );
Note: You need lib SDL_gfx 2.0.17 or greater for this function.
textured_polygon_MT π
int SDL::GFX::Primitives::textured_polygon_MT( $surface, $vx, $vy, $n, $texture, $texture_dx, $texture_dy, $polyInts, $polyAllocated );
Note: You need lib SDL_gfx 2.0.17 or greater for this function.
bezier π¦
int SDL::GFX::Primitives::bezier_color( $surface, $vx, $vy, $n, $s, $color );
int SDL::GFX::Primitives::bezier_RGBA( $surface, $vx, $vy, $n, $s, $r, $g, $b, $a );
$n is the number of elements in $vx and $vy, and $s is the number of steps. So the bigger $s is, the smother it becomes.
Example:
SDL::GFX::Primitives::bezier_color($display, [390, 392, 394, 396], [243, 255, 235, 247], 4, 20, 0xFF00FFFF);
character π
int SDL::GFX::Primitives::character_color( $surface, $x, $y, $c, $color );
int SDL::GFX::Primitives::character_RGBA( $surface, $x, $y, $c, $r, $g, $b, $a );
$c is the character that will be drawn at $x,$y.
string πΈ
int SDL::GFX::Primitives::string_color( $surface, $x, $y, $c, $color );
int SDL::GFX::Primitives::string_RGBA( $surface, $x, $y, $c, $r, $g, $b, $a );
set_font π€
void SDL::GFX::Primitives::set_font(fontdata, $cw, $ch );
The fontsets are included in the SDL_gfx distribution. Check http://www.ferzkopp.net/joomla/content/view/19/14/ for more.
Example:
my $font = '';
open(FH, '<', 'data/5x7.fnt');
binmode(FH);
read(FH, $font, 4096);
close(FH);
SDL::GFX::Primitives::set_font($font, 5, 7);
π AUTHORS π
See "AUTHORS" in SDL.
mwah π this page is from Perl v5.42.0, dated 2024-05-01, and itβs the pods::...itives(3pm) manual. bye bestie π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms