NAME
SDL2::surface - SDL2::Surface Management Functions
SYNOPSIS
use SDL2 qw[:surface];
DESCRIPTION
SDL2::surface contains enumerations, functions, and other values used to manage a SDL2::Surface structure.
Functions
These may be imported with the :surface
tag or individually by name.
SDL_CreateRGBSurface( ... )
Allocate a new RGB surface.
my ( $height, $width ) = ( 100, 100 );
# Create a 32-bit surface with the bytes of each pixel in R,G,B,A order,
# as expected by OpenGL for textures
my ( $rmask, $gmask, $bmask, $amask );
# SDL interprets each pixel as a 32-bit number, so our masks must depend
# on the endianness (byte order) of the machine
if ( SDL_BYTEORDER() eq SDL_LIL_ENDIAN() ) {
$rmask = 0xff000000;
$gmask = 0x00ff0000;
$bmask = 0x0000ff00;
$amask = 0x000000ff;
}
else {
$rmask = 0x000000ff;
$gmask = 0x0000ff00;
$bmask = 0x00ff0000;
$amask = 0xff000000;
}
my $surface = SDL_CreateRGBSurface( 0, $width, $height, 32, $rmask, $gmask, $bmask, $amask );
if ( !defined $surface ) {
SDL_Log( 'SDL_CreateRGBSurface() failed: %s', SDL_GetError() );
exit 1;
}
# or using the default masks for the depth:
$surface = SDL_CreateRGBSurface( 0, $width, $height, 32, 0, 0, 0, 0 );
If depth
is 4 or 8 bits, an empty palette is allocated for the surface. If depth
is greater than 8 bits, the pixel format is set using the [RGBA]mask parameters.
The [RGBA]mask parameters are the bitmasks used to extract that color from a pixel. For instance, `Rmask` being 0xFF000000 means the red data is stored in the most significant byte. Using zeros for the RGB masks sets a default value, based on the depth. For example:
SDL_CreateRGBSurface( 0, $w, $h, 32, 0, 0, 0, 0 );
However, using zero for the Amask results in an Amask of 0.
By default surfaces with an alpha mask are set up for blending as with:
SDL_SetSurfaceBlendMode( $surface, SDL_BLENDMODE_BLEND );
You can change this by calling SDL_SetSurfaceBlendMode( ... )
and selecting a different blendMode
.
Expected parameters include:
flags
- the flags are unused and should be set to 0width
- the width of the surfaceheight
- the height of the surfacedepth
- the depth of the surface in bitsRmask
- the red mask for the pixelsGmask
- the green mask for the pixelsBmask
- the blue mask for the pixelsAmask
- the alpha mask for the pixels
Returns the new SDL2::Surface structure that is created or undef
if it fails; call SDL_GetError( )
for more information.
SDL_CreateRGBSurfaceWithFormat( ... )
Allocate a new RGB surface with a specific pixel format.
# Create a 32-bit surface with the bytes of each pixel in R,G,B,A order,
# as expected by OpenGL for textures
my $surf = SDL_CreateRGBSurfaceWithFormat( 0, 100, 100, 32, SDL_PIXELFORMAT_RGBA32 );
if ( !defined $surf ) {
SDL_Log( "SDL_CreateRGBSurfaceWithFormat() failed: %s", SDL_GetError() );
exit 1;
}
This function operates mostly like SDL_CreateRGBSurface( ... )
, except instead of providing pixel color masks, you provide it with a predefined format from SDL_PixelFormatEnum
.
Expected parameters include:
flags
- the flags are unused and should be set to0
width
- the width of the surfaceheight
- the height of the surfacedepth
- the depth of the surface in bitsformat
- theSDL_PixelFormatEnum
for the new surface's pixel format.
Returns the new SDL2::Surface structure that is created or undef
if it fails; call SDL_GetError( )
for more information.
SDL_CreateRGBSurfaceFrom( ... )
Allocate a new RGB surface with existing pixel data.
# Declare an SDL2::Surface to be filled with raw pixel data
my $pixels = [
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0aab,
0x0789, 0x0bcc, 0x0eee, 0x09aa, 0x099a, 0x0ddd, 0x0fff, 0x0eee, 0x0899, 0x0fff,
0x0fff, 0x1fff, 0x0dde, 0x0dee, 0x0fff, 0xabbc, 0xf779, 0x8cdd, 0x3fff, 0x9bbc,
0xaaab, 0x6fff, 0x0fff, 0x3fff, 0xbaab, 0x0fff, 0x0fff, 0x6689, 0x6fff, 0x0dee,
0xe678, 0xf134, 0x8abb, 0xf235, 0xf678, 0xf013, 0xf568, 0xf001, 0xd889, 0x7abc,
0xf001, 0x0fff, 0x0fff, 0x0bcc, 0x9124, 0x5fff, 0xf124, 0xf356, 0x3eee, 0x0fff,
0x7bbc, 0xf124, 0x0789, 0x2fff, 0xf002, 0xd789, 0xf024, 0x0fff, 0x0fff, 0x0002,
0x0134, 0xd79a, 0x1fff, 0xf023, 0xf000, 0xf124, 0xc99a, 0xf024, 0x0567, 0x0fff,
0xf002, 0xe678, 0xf013, 0x0fff, 0x0ddd, 0x0fff, 0x0fff, 0xb689, 0x8abb, 0x0fff,
0x0fff, 0xf001, 0xf235, 0xf013, 0x0fff, 0xd789, 0xf002, 0x9899, 0xf001, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0xe789, 0xf023, 0xf000, 0xf001, 0xe456, 0x8bcc, 0xf013,
0xf002, 0xf012, 0x1767, 0x5aaa, 0xf013, 0xf001, 0xf000, 0x0fff, 0x7fff, 0xf124,
0x0fff, 0x089a, 0x0578, 0x0fff, 0x089a, 0x0013, 0x0245, 0x0eff, 0x0223, 0x0dde,
0x0135, 0x0789, 0x0ddd, 0xbbbc, 0xf346, 0x0467, 0x0fff, 0x4eee, 0x3ddd, 0x0edd,
0x0dee, 0x0fff, 0x0fff, 0x0dee, 0x0def, 0x08ab, 0x0fff, 0x7fff, 0xfabc, 0xf356,
0x0457, 0x0467, 0x0fff, 0x0bcd, 0x4bde, 0x9bcc, 0x8dee, 0x8eff, 0x8fff, 0x9fff,
0xadee, 0xeccd, 0xf689, 0xc357, 0x2356, 0x0356, 0x0467, 0x0467, 0x0fff, 0x0ccd,
0x0bdd, 0x0cdd, 0x0aaa, 0x2234, 0x4135, 0x4346, 0x5356, 0x2246, 0x0346, 0x0356,
0x0467, 0x0356, 0x0467, 0x0467, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff,
0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff
];
my $surface
= SDL_CreateRGBSurfaceFrom( $pixels, 16, 16, 16, 16 * 2, 0x0f00, 0x00f0, 0x000f, 0xf000 );
# Set the icon to the window
SDL_SetWindowIcon( $window, $surface ) if $surface;
# No longer required
SDL_FreeSurface( $surface );
This function operates mostly like SDL_CreateRGBSurface( ... )
, except it does not allocate memory for the pixel data, instead the caller provides an existing buffer of data for the surface to use.
No copy is made of the pixel data. Pixel data is not managed automatically; you must free the surface before you free the pixel data.
Expected parameters include:
pixels
- a pointer to existing pixel datawidth
- the width of the surfaceheight
- the height of the surfacedepth
- the depth of the surface in bitspitch
- the pitch of the surface in bytesRmask
- the red mask for the pixelsGmask
- the green mask for the pixelsBmask
- the blue mask for the pixelsAmask
- the alpha mask for the pixels
Returns the new SDL2::Surface structure that is created or NULL if it fails; call SDL_GetError( )
for more information.
SDL_CreateRGBSurfaceWithFormatFrom( ... )
Allocate a new RGB surface with with a specific pixel format and existing pixel data.
This function operates mostly like SDL_CreateRGBSurfaceFrom( ... )
, except instead of providing pixel color masks, you provide it with a predefined format from SDL_PixelFormatEnum
.
No copy is made of the pixel data. Pixel data is not managed automatically; you must free the surface before you free the pixel data.
Expected parameters include:
pixels
- a pointer to existing pixel datawidth
- the width of the surfaceheight
- the height of the surfacedepth
- the depth of the surface in bitspitch
- the pitch of the surface in bytesformat
- theSDL_PixelFormatEnum
for the new surface's pixel format.
Returns the new SDL2::Surface structure that is created or undef
if it fails; call SDL_GetError( )
for more information.
SDL_FreeSurface( ... )
Free an RGB surface.
Expected parameters include:
SDL_SetSurfacePalette( ... )
Set the palette used by a surface.
A single palette can be shared with many surfaces.
Expected parameters include:
surface
- the SDL2::Surface structure to updatepalette
- the SDL2::Palette structure to use
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_LockSurface( ... )
Set up a surface for directly accessing the pixels.
Between calls to SDL_LockSurface( ... )
/ SDL_UnlockSurface( ... )
, you can write to and read from surface->pixels
, using the pixel format stored in surface->format
. Once you are done accessing the surface, you should use SDL_UnlockSurface( ... )
to release it.
Not all surfaces require locking. If SDL_MUSTLOCK(surface)
evaluates to 0
, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
Expected parameters include:
surface
- the SDL2::Surface structure to be locked
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_UnlockSurface( ... )
Release a surface after directly accessing the pixels.
Expected parameters include:
surface
- the SDL2::Surface structure to be unlocked
SDL_LoadBMP_RW( ... )
Load a BMP image from a seekable SDL data stream.
The new surface should be freed with SDL_FreeSurface( ... )
.
Expected parameters include:
Returns a pointer to a new SDL2::Surface structure or undef
if there was an error; call SDL_GetError( )
for more information.
SDL_LoadBMP( ... )
Load a surface from a file.
my $surface = SDL_LoadBMP( './icons/16x16.bmp' );
Expected parameters include:
Returns a pointer to a new SDL2::Surface structure or undef
if there was an error; call SDL_GetError( )
for more information.
SDL_SaveBMP_RW( ... )
Save a surface to a seekable SDL data stream in BMP format.
Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.
Expected parameters include:
surface
- the SDL2::Surface structure containing the image to be saveddst
- a data stream to save tofreedst
- non-zero to close the stream after being written
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SaveBMP( ... )
Save a surface to a file.
SDL_SaveBMP( $surface, './icons/output.bmp' );
Expected parameters include:
surface
- the SDL2::Surface structure containing the image to be savedfile
- file to save to
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SetSurfaceRLE( ... )
Set the RLE acceleration hint for a surface.
If RLE is enabled, color key and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.
Expected parameters include:
surface
- the SDL2::Surface structure to optimizeflag
-0
to disable, non-zero to enable RLE acceleration
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_HasSurfaceRLE( ... )
Returns whether the surface is RLE enabled
Expected parameters include:
surface
the SDL2::Surface structure to query
Returns SDL_TRUE
if the surface is RLE enabled, SDL_FALSE
otherwise.
SDL_SetColorKey( ... )
Set the color key (transparent pixel) in a surface.
The color key defines a pixel value that will be treated as transparent in a blit. It is a pixel of the format used by the surface, as generated by SDL_MapRGB( ... )
.
RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels. See SDL_SetSurfaceRLE( ... )
for details.
Expected parameters include:
surface
- the SDL2::Surface structure to updateflag
-SDL_TRUE
to enable color key,SDL_FALSE
to disable color keykey
- the transparent pixel
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_HasColorKey( ... )
Returns whether the surface has a color key.
Expected parameters include:
surface
- the SDL2::Surface structure to query
Returns SDL_TRUE
if the surface has a color key, SDL_FALSE
otherwise.
SDL_GetColorKey( ... )
Get the color key (transparent pixel) for a surface.
The color key is a pixel of the format used by the surface, as generated by SDL_MapRGB( )
.
If the surface doesn't have color key enabled this function returns -1
.
Expected parameters include:
surface
- the SDL2::Surface structure to querykey
a pointer filled in with the transparent pixel
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SetSurfaceColorMod( ... )
Set an additional color value multiplied into blit operations.
When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula: srcC = srcC * (color / 255)
Expected parameters include:
surface
- the SDL2::Surface structure to updater
- the red color value multiplied into blit operationsg
- the green color value multiplied into blit operationsb
- the blue color value multiplied into blit operations
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_GetSurfaceColorMod( ... )
Get the additional color value multiplied into blit operations.
Expected parameters include:
surface
- the SDL2::Surface structure to queryr
- a pointer filled in with the current red color valueg
- a pointer filled in with the current green color valueb
- a pointer filled in with the current blue color value
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SetSurfaceAlphaMod( ... )
Set an additional alpha value used in blit operations.
When this surface is blitted, during the blit operation the source alpha value is modulated by this alpha value according to the following formula: srcA = srcA * (alpha / 255)
.
Expected parameters include:
surface
- the SDL2::Surface structure to updatealpha
- the alpha value multiplied into blit operations
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_GetSurfaceAlphaMod( ... )
Get the additional alpha value used in blit operations.
Expected parameters include:
surface
- the SDL2::Surface structure to queryalpha
- a pointer filled in with the current alpha value
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SetSurfaceBlendMode( ... )
Set the blend mode used for blit operations.
To copy a surface to another surface (or texture) without blending with the existing data, the blendmode of the SOURCE surface should be set to SDL_BLENDMODE_NONE
.
Expected parameters include:
surface
- the SDL2::Surface structure to updateblendMode
- the SDL_BlendMode to use for blit blending
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_GetSurfaceBlendMode( ... )
Get the blend mode used for blit operations.
Expected parameters include:
surface
- the SDL2::Surface structure to queryblendMode
- a pointer filled in with the current SDL_BlendMode
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SetClipRect( ... )
Set the clipping rectangle for a surface.
When surface
is the destination of a blit, only the area within the clip rectangle is drawn into.
Note that blits are automatically clipped to the edges of the source and destination surfaces.
Expected parameters include:
surface
- the SDL2::Surface structure to be clippedrect
- the SDL_Rect structure representing the clipping rectangle, orundef
to disable clipping
Returns SDL_TRUE
if the rectangle intersects the surface, otherwise SDL_FALSE
and blits will be completely clipped.
SDL_GetClipRect( ... )
Get the clipping rectangle for a surface.
When surface
is the destination of a blit, only the area within the clip rectangle is drawn into.
Expected parameters include:
surface
- the SDL2::Surface structure representing the surface to be clippedrect
- an SDL_Rect structure filled in with the clipping rectangle for the surface
SDL_DuplicateSurface( ... )
Creates a new surface identical to the existing surface.
The returned surface should be freed with SDL_FreeSurface( ... )
.
Expected parameters include:
Returns a copy of the surface, or undef
on failure; call SDL_GetError( )
for more information.
SDL_ConvertSurface( ... )
Copy an existing surface to a new surface of the specified format.
This function is used to optimize images for faster *repeat* blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.
Expected parameters include:
src
- the existing SDL_Surface structure to convertfmt
- the SDL_PixelFormat structure that the new surface is optimized forflags
- the flags are unused and should be set to 0; this is a leftover from SDL 1.2's API
Returns the new SDL2::Surface structure that is created or undef
if it fails; call SDL_GetError( )
for more information.
SDL_ConvertSurfaceFormat( ... )
Copy an existing surface to a new surface of the specified format enum.
This function operates just like SDL_ConvertSurface( ... )
, but accepts an SDL_PixelFormatEnum
value instead of an SDL_PixelFormat structure. As such, it might be easier to call but it doesn't have access to palette information for the destination surface, in case that would be important.
Expected parameters include:
src
- the existing SDL2::Surface structure to convertpixel_format
- theSDL_PixelFormatEnum
that the new surface is optimized forflags
- the flags are unused and should be set to 0; this is a leftover from SDL 1.2's API
Returns the new SDL2::Surface structure that is created or undef
if it fails; call SDL_GetError( )
for more information.
SDL_ConvertPixels( ... )
Copy a block of pixels of one format to another format.
Expected parameters include:
width
- the width of the block to copy, in pixelsheight
- the height of the block to copy, in pixelssrc_format
- anSDL_PixelFormatEnum
value of thesrc
pixels formatsrc
- a pointer to the source pixelssrc_pitch
- the pitch of the block to copy, in bytesdst_format
- anSDL_PixelFormatEnum
value of thedst
pixels formatdst
- a pointer to be filled in with new pixel datadst_pitch
- the pitch of the destination pixels, in bytes
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_FillRect( ... )
Perform a fast fill of a rectangle with a specific color.
color
should be a pixel of the format used by the surface, and can be generated by SDL_MapRGB( ... )
or SDL_MapRGBA( ... )
. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via SDL_SetClipRect( ... )
), then this function will fill based on the intersection of the clip rectangle and rect
.
Expected parameters include:
dst
- the SDL2::Surface structure that is the drawing targetrect
- the SDL_Rect structure representing the rectangle to fill, orundef
to fill the entire surfacecolor
- the color to fill with
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_FillRects( ... )
Perform a fast fill of a set of rectangles with a specific color.
my @rects = (
SDL2::Rect->new( { w => 100, h => 100, x => 0, y => 0 } ),
SDL2::Rect->new( { w => 100, h => 100, x => 200, y => 20 } )
);
my $surface = SDL_LoadBMP('./imgs/640_426.bmp');
SDL_FillRects( $surface, \@rects, scalar @rects, 255 ); # blue
SDL_SaveBMP( $surface, './imgs/new_640_426.bmp' );
color
should be a pixel of the format used by the surface, and can be generated by SDL_MapRGB( ... )
or SDL_MapRGBA( ... )
. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via SDL_SetClipRect( ... )
), then this function will fill based on the intersection of the clip rectangle and rect
.
Expected parameters include:
dst
- the SDL2::Surface structure that is the drawing targetrects
- an array ofSDL2::Rects
representing the rectangles to fill.count
- the number of rectangles in the arraycolor
- the color to fill with
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_BlitSurface( ... )
Performs a fast blit from the source surface to the destination surface.
Expected parameters include:
src
- theSDL2::Surface
structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
This assumes that the source and destination rectangles are the same size. If either srcrect
or dstrect
are undef
, the entire surface (src
or dst
) is copied. The final blit rectangles are saved in srcrect
and dstrect
after all clipping is performed.
If the blit is successful, it returns 0
, otherwise it returns -1
.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
RGBA->RGB:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored.
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source color key, ignoring alpha in the
comparison.
RGB->RGBA:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB, set destination alpha to source per-surface alpha value.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source color key.
RGBA->RGBA:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored.
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source color key, ignoring alpha in the
comparison.
RGB->RGB:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source color key.
You should call SDL_BlitSurface( ... )
unless you know exactly how SDL blitting works internally and how to use the other blit functions.
Returns 0
if the blit is successful or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_UpperBlit( )
Perform a fast blit from the source surface to the destination surface.
Expected parameters include:
src
- theSDL2::Surface
structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
SDL_UpperBlit( ... )
has been replaced by SDL_BlitSurface( ... )
, which is merely a wrapper for this function with a less confusing name.
Returns 0
if the blit is successful or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_LowerBlit( ... )
Perform low-level surface blitting only.
This is a semi-private blit function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
Unless you know what you're doing, you should be using SDL_BlitSurface( ... )
instead.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_SoftStretch( ... )
Perform a fast, low quality, stretch blit between two surfaces of the same format.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Warning: This function uses a static buffer, and is not thread-safe.
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
Please use SDL_BlitScaled( ... )
instead.
SDL_SoftStretchLinear( ... )
Perform bilinear scaling between two surfaces of the same format, 32BPP.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
Please use SDL_BlitScaled( ... )
instead.
SDL_BlitScaled( ... )
Perform a scaled surface copy to a destination surface.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_UpperBlitScaled( ... )
Perform a scaled surface copy to a destination surface.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
SDL_UpperBlitScaled( ... )
has been replaced by SDL_BlitScaled( ... )
, which is merely a wrapper for this function with a less confusing name.
SDL_LowerBlitScaled( ... )
Perform low-level surface scaled blitting only.
Expected parameters include:
src
- the SDL2::Surface structure to be copied fromsrcrect
- the SDL2::Rect structure representing the rectangle to be copied, orundef
to copy the entire surfacedst
- the SDL2::Surface structure that is the blit targetdstrect
- the SDL2::Rect structure representing the rectangle that is copied into
Returns 0
on success or a negative error code on failure; call SDL_GetError( )
for more information.
This is a semi-private function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
SDL_SetYUVConversionMode( ... )
Set the YUV conversion mode.
Expected parameters include;
SDL_GetYUVConversionMode( )
Get the YUV conversion mode.
Returns a SDL_GetYUVConversionMode
value.
SDL_GetYUVConversionModeForResolution( ... )
Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
.
Expected parameters include:
width
height
Returns a SDL_YUV_CONVERSION_MODE
value.
Defined Values and Enumerations
These may be imported with the given tag or individually by name.
SDL_YUV_CONVERSION_MODE
The formula used for converting between YUV and RGB. These values may be imported with the :YUV_CONVERSION_MODE
tag.
SDL_YUV_CONVERSION_JPEG
- Full range JPEGSDL_YUV_CONVERSION_BT601
- BT.601 (the default)SDL_YUV_CONVERSION_BT709
- BT.709SDL_YUV_CONVERSION_AUTOMATIC
- BT.601 for SD content, BT.709 for HD content
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
AUTHOR
Sanko Robinson <sanko@cpan.org>