|
These are the currently supported flags for the SDL_Surface.
Used internally (read-only).
|
#define | SDL_SWSURFACE 0 |
|
#define | SDL_PREALLOC 0x00000001 |
|
#define | SDL_RLEACCEL 0x00000002 |
|
#define | SDL_DONTFREE 0x00000004 |
|
#define | SDL_SIMD_ALIGNED 0x00000008 |
|
#define | SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) |
|
enum | SDL_YUV_CONVERSION_MODE {
SDL_YUV_CONVERSION_JPEG
,
SDL_YUV_CONVERSION_BT601
,
SDL_YUV_CONVERSION_BT709
,
SDL_YUV_CONVERSION_AUTOMATIC
} |
| The formula used for converting between YUV and RGB. More...
|
|
typedef struct SDL_BlitMap | SDL_BlitMap |
|
typedef int(* | SDL_blit) (struct SDL_Surface *src, const SDL_Rect *srcrect, struct SDL_Surface *dst, const SDL_Rect *dstrect) |
| The type of function used for surface blitting functions.
|
|
SDL_Surface * | SDL_CreateSurface (int width, int height, Uint32 format) |
|
SDL_Surface * | SDL_CreateSurfaceFrom (void *pixels, int width, int height, int pitch, Uint32 format) |
|
void | SDL_DestroySurface (SDL_Surface *surface) |
|
int | SDL_SetSurfacePalette (SDL_Surface *surface, SDL_Palette *palette) |
|
int | SDL_LockSurface (SDL_Surface *surface) |
|
void | SDL_UnlockSurface (SDL_Surface *surface) |
|
SDL_Surface * | SDL_LoadBMP_RW (SDL_RWops *src, SDL_bool freesrc) |
|
SDL_Surface * | SDL_LoadBMP (const char *file) |
|
int | SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst) |
|
int | SDL_SaveBMP (SDL_Surface *surface, const char *file) |
|
int | SDL_SetSurfaceRLE (SDL_Surface *surface, int flag) |
|
SDL_bool | SDL_SurfaceHasRLE (SDL_Surface *surface) |
|
int | SDL_SetSurfaceColorKey (SDL_Surface *surface, int flag, Uint32 key) |
|
SDL_bool | SDL_SurfaceHasColorKey (SDL_Surface *surface) |
|
int | SDL_GetSurfaceColorKey (SDL_Surface *surface, Uint32 *key) |
|
int | SDL_SetSurfaceColorMod (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b) |
|
int | SDL_GetSurfaceColorMod (SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b) |
|
int | SDL_SetSurfaceAlphaMod (SDL_Surface *surface, Uint8 alpha) |
|
int | SDL_GetSurfaceAlphaMod (SDL_Surface *surface, Uint8 *alpha) |
|
int | SDL_SetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode blendMode) |
|
int | SDL_GetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode *blendMode) |
|
SDL_bool | SDL_SetSurfaceClipRect (SDL_Surface *surface, const SDL_Rect *rect) |
|
int | SDL_GetSurfaceClipRect (SDL_Surface *surface, SDL_Rect *rect) |
|
SDL_Surface * | SDL_DuplicateSurface (SDL_Surface *surface) |
|
SDL_Surface * | SDL_ConvertSurface (SDL_Surface *surface, const SDL_PixelFormat *format) |
|
SDL_Surface * | SDL_ConvertSurfaceFormat (SDL_Surface *surface, Uint32 pixel_format) |
|
int | SDL_ConvertPixels (int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) |
|
int | SDL_PremultiplyAlpha (int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) |
|
int | SDL_FillSurfaceRect (SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) |
|
int | SDL_FillSurfaceRects (SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color) |
|
int | SDL_BlitSurface (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
|
int | SDL_BlitSurfaceUnchecked (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) |
|
int | SDL_SoftStretch (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) |
|
int | SDL_SoftStretchLinear (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) |
|
int | SDL_BlitSurfaceScaled (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
|
int | SDL_BlitSurfaceUncheckedScaled (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) |
|
void | SDL_SetYUVConversionMode (SDL_YUV_CONVERSION_MODE mode) |
|
SDL_YUV_CONVERSION_MODE | SDL_GetYUVConversionMode (void) |
|
SDL_YUV_CONVERSION_MODE | SDL_GetYUVConversionModeForResolution (int width, int height) |
|
Header file for SDL_Surface definition and management functions.
Definition in file SDL_surface.h.
Performs a fast blit from the source surface to the destination surface.
This assumes that the source and destination rectangles are the same size. If either srcrect
or dstrect
are NULL, the entire surface (src
or dst
) is copied. The final blit rectangles are saved in srcrect
and dstrect
after all clipping is performed.
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:
alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored.
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:
alpha-blend (using the source per-surface alpha)
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:
alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored.
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:
alpha-blend (using the source per-surface alpha)
copy RGB.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source color key.
- Parameters
-
src | the SDL_Surface structure to be copied from |
srcrect | the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
dst | the SDL_Surface structure that is the blit target |
dstrect | the SDL_Rect structure representing the target rectangle in the destination surface, filled with the actual rectangle used after clipping |
- Returns
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_BlitSurface
SDL_Surface * SDL_CreateSurfaceFrom |
( |
void * |
pixels, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
pitch, |
|
|
Uint32 |
format |
|
) |
| |
|
extern |
Allocate a new RGB surface with a specific pixel format and existing pixel data.
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.
Pitch is the offset in bytes from one row of pixels to the next, e.g. width*4
for SDL_PIXELFORMAT_RGBA8888
.
You may pass NULL for pixels and 0 for pitch to create a surface that you will fill in with valid values later.
- Parameters
-
pixels | a pointer to existing pixel data |
width | the width of the surface |
height | the height of the surface |
pitch | the pitch of the surface in bytes |
format | the SDL_PixelFormatEnum for the new surface's pixel format. |
- Returns
- the new SDL_Surface structure that is created or NULL if it fails; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_CreateSurface
-
SDL_DestroySurface
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_SetSurfaceClipRect()), then this function will fill based on the intersection of the clip rectangle and rect
.
- Parameters
-
dst | the SDL_Surface structure that is the drawing target |
rect | the SDL_Rect structure representing the rectangle to fill, or NULL to fill the entire surface |
color | the color to fill with |
- Returns
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_FillSurfaceRects
Perform a fast fill of a set of rectangles 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_SetSurfaceClipRect()), then this function will fill based on the intersection of the clip rectangle and rect
.
- Parameters
-
dst | the SDL_Surface structure that is the drawing target |
rects | an array of SDL_Rects representing the rectangles to fill. |
count | the number of rectangles in the array |
color | the color to fill with |
- Returns
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_FillSurfaceRect
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.
- Parameters
-
- Returns
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_MUSTLOCK
-
SDL_UnlockSurface
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. For example, one can use this to specify that cyan pixels should be considered transparent, and therefore not rendered.
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.
- Parameters
-
surface | the SDL_Surface structure to update |
flag | SDL_TRUE to enable color key, SDL_FALSE to disable color key |
key | the transparent pixel |
- Returns
- 0 on success or a negative error code on failure; call SDL_GetError() for more information.
- Since
- This function is available since SDL 3.0.0.
- See also
- SDL_BlitSurface
-
SDL_GetSurfaceColorKey