pods::...urface(3pm)
πΈ NAME πΈ
okay so bestie, this is the manual page for SDL::Surface β literally Graphic surface structure. It comes from the User Contributed Perl Documentation corner of the universe, and the manual name is pods::...urface(3pm) (yes, with the dots, we donβt question it π
).
β¨ CATEGORY β¨
Core, Video, Structure β thatβs the category trifecta, periodt.
π¦ SYNOPSIS π¦
copy-paste this and youβre lowkey in the group chat:
use SDL;
use SDL::Video;
use SDL::Surface;
# Create the main surface (display)
SDL::init(SDL_INIT_VIDEO);
my $display = SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
# Create other surfaces attached to the $display.
my $surface = SDL::Surface->new(SDL_ASYNCBLIT | SDL_HWSURFACE, 640, 480, 16, 0, 0, 0, 0);
my $surface2 = SDL::Surface->new_from($surface, 100, 100, 8, 0, 0, 0, 0);
π DESCRIPTION π
An SDL_Surface defines a surfaceangular area of pixels. Thatβs the description, bestie β surfaceangular is literally the word, and honestly? It ate. π
π CONSTANTS π
The constants for SDL::Surface belong to SDL::Video, under the export tag of :surface. iykyk.
SDL_ASYNCBLITβ Use asynchronous blit if possibleSDL_SWSURFACEβ Store in system memorySDL_HWSURFACEβ Store in video memory
π«Ά METHODS π«Ά
new
my $surface = SDL::Surface->new(
$flags, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
);
The constructor creates a new surface with the specified parameter values.
The four mask values are the bits that the channel will ignore. For example, an Rmask of 0xFF will ignore that channel completely, making everything on the surface more green/blue. not me explaining masks but okay π
new_from
my $surface = SDL::Surface->new_from(
$surface, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
);
The constructor creates a new surface with the specified parameter values. The flags are taken from the specified $surface.
w
my $w = $surface->w;
Returns the width of the surface. SDL::Surface width is defined at construction so this is read-only. no take-backsies, bestie.
h
my $h = $surface->h;
Returns the height of the surface. SDL::Surface height is defined at construction so this is read-only.
format
my $format = $surface->format;
The format of the pixels stored in the surface. See SDL::PixelFormat. slay.
pitch
my $pitch = $surface->pitch;
The scanline length in bytes.
π Direct Write to Surface Pixel π
Disclaimer: The following methods can be very slow, making them suitable for creating surfaces, but not for animations. this is your warning, bestie π
get_pixel
my $pixel = $surface->get_pixel( $offset )
Returns the numeric pixel value for the given $offset. The pixel value depends on current pixel format.
Note: For surfaces with a palette (1 byte per pixel) the palette index is returned instead of color values.
set_pixels
$surface->set_pixels( $offset, $value );
Sets the pixel $value to the given $offset. The pixel value must fit the pixel format of the surface.
Note: For surfaces with a palette (1 byte per pixel) the palette index must be passed instead of color values.
Example:
sub putpixel {
my ($x, $y, $color) = @_;
$display->set_pixels( $x + $y * $display->w, $color);
}
See also examples/pixel_operations/sols/ch02.pl! β yes, with the exclamation mark. iconic.
get_pixels_ptr
my $ptr = $surface->get_pixels_ptr;
Returns a reference to the surface's pixels.
π SEE ALSO π
SDLSDL::PixelFormatSDL::VideoSDL::Rect
π AUTHORS π
See "AUTHORS" in SDL. thatβs the whole note, bestie π«Ά
okay bye bestie π this page is literally from perl v5.42.3, dated 2026-08-19, and it lives at pods::...urface(3pm) β mwah β¨π
π¦ where this page comes from
- ubuntu stonking: libsdl-perl 2.548-6build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms