SDL
2.0
|
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_blendmode.h"
#include "SDL_rwops.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Data Structures | |
struct | SDL_Surface |
A collection of pixels used in software blitting. More... | |
Macros | |
#define | SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) |
#define | SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) |
#define | SDL_SaveBMP(surface, file) SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) |
#define | SDL_BlitSurface SDL_UpperBlit |
#define | SDL_BlitScaled SDL_UpperBlitScaled |
Surface flags | |
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 |
Typedefs | |
typedef int(* | SDL_blit) (struct SDL_Surface *src, SDL_Rect *srcrect, struct SDL_Surface *dst, SDL_Rect *dstrect) |
The type of function used for surface blitting functions. More... | |
Functions | |
SDL_Surface * | SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
SDL_Surface * | SDL_CreateRGBSurfaceFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
void | SDL_FreeSurface (SDL_Surface *surface) |
int | SDL_SetSurfacePalette (SDL_Surface *surface, SDL_Palette *palette) |
Set the palette used by a surface. More... | |
int | SDL_LockSurface (SDL_Surface *surface) |
Sets up a surface for directly accessing the pixels. More... | |
void | SDL_UnlockSurface (SDL_Surface *surface) |
SDL_Surface * | SDL_LoadBMP_RW (SDL_RWops *src, int freesrc) |
int | SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, int freedst) |
int | SDL_SetSurfaceRLE (SDL_Surface *surface, int flag) |
Sets the RLE acceleration hint for a surface. More... | |
int | SDL_SetColorKey (SDL_Surface *surface, int flag, Uint32 key) |
Sets the color key (transparent pixel) in a blittable surface. More... | |
int | SDL_GetColorKey (SDL_Surface *surface, Uint32 *key) |
Gets the color key (transparent pixel) in a blittable surface. More... | |
int | SDL_SetSurfaceColorMod (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b) |
Set an additional color value used in blit operations. More... | |
int | SDL_GetSurfaceColorMod (SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b) |
Get the additional color value used in blit operations. More... | |
int | SDL_SetSurfaceAlphaMod (SDL_Surface *surface, Uint8 alpha) |
Set an additional alpha value used in blit operations. More... | |
int | SDL_GetSurfaceAlphaMod (SDL_Surface *surface, Uint8 *alpha) |
Get the additional alpha value used in blit operations. More... | |
int | SDL_SetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode blendMode) |
Set the blend mode used for blit operations. More... | |
int | SDL_GetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode *blendMode) |
Get the blend mode used for blit operations. More... | |
SDL_bool | SDL_SetClipRect (SDL_Surface *surface, const SDL_Rect *rect) |
void | SDL_GetClipRect (SDL_Surface *surface, SDL_Rect *rect) |
SDL_Surface * | SDL_ConvertSurface (SDL_Surface *src, const SDL_PixelFormat *fmt, Uint32 flags) |
SDL_Surface * | SDL_ConvertSurfaceFormat (SDL_Surface *src, Uint32 pixel_format, Uint32 flags) |
int | SDL_ConvertPixels (int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) |
Copy a block of pixels of one format to another format. More... | |
int | SDL_FillRect (SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) |
int | SDL_FillRects (SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color) |
int | SDL_UpperBlit (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
int | SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
int | SDL_SoftStretch (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) |
Perform a fast, low quality, stretch blit between two surfaces of the same pixel format. More... | |
int | SDL_UpperBlitScaled (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
int | SDL_LowerBlitScaled (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
Header file for SDL_Surface definition and management functions.
Definition in file SDL_surface.h.
#define SDL_BlitScaled SDL_UpperBlitScaled |
Definition at line 476 of file SDL_surface.h.
Referenced by SW_RenderCopy(), and SW_RenderCopyEx().
#define SDL_BlitSurface SDL_UpperBlit |
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: 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.
Definition at line 447 of file SDL_surface.h.
Referenced by _testBlitBlendMode(), SDL_UpperBlitScaled(), SW_RenderCopy(), and SW_RenderCopyEx().
#define SDL_DONTFREE 0x00000004 |
Surface is referenced internally
Definition at line 55 of file SDL_surface.h.
Referenced by SDL_DestroyWindow(), SDL_FreeSurface(), SDL_GetWindowSurface(), and SDL_RecreateWindow().
#define SDL_LoadBMP | ( | file | ) | SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) |
Load a surface from a file.
Convenience macro.
Definition at line 182 of file SDL_surface.h.
Referenced by LoadSprite(), LoadTexture(), main(), SDLTest_LoadIcon(), surface_testLoadFailure(), and surface_testSaveLoadBitmap().
#define SDL_MUSTLOCK | ( | S | ) | (((S)->flags & SDL_RLEACCEL) != 0) |
Evaluates to true if the surface needs to be locked before access.
Definition at line 61 of file SDL_surface.h.
Referenced by SDL_CalculateShapeBitmap(), SDL_CalculateShapeTree(), SDL_CreateTextureFromSurface(), SDL_RLEAlphaBlit(), SDL_RLEBlit(), SDL_SoftBlit(), SDL_SoftStretch(), SDLgfx_rotateSurface(), and SW_UpdateTexture().
#define SDL_PREALLOC 0x00000001 |
Surface uses preallocated memory
Definition at line 53 of file SDL_surface.h.
Referenced by RLEAlphaSurface(), RLEColorkeySurface(), SDL_CreateRGBSurfaceFrom(), SDL_CreateSurfaceOnStack(), SDL_FreeSurface(), and SDL_UnRLESurface().
#define SDL_RLEACCEL 0x00000002 |
Surface is RLE encoded
Definition at line 54 of file SDL_surface.h.
Referenced by SDL_CalculateBlit(), SDL_ConvertSurface(), SDL_FreeSurface(), SDL_LockSurface(), SDL_MapSurface(), SDL_RLESurface(), SDL_SetColorKey(), SDL_UnlockSurface(), SDL_UnRLESurface(), SDLgfx_rotateSurface(), surface_testCompleteSurfaceConversion(), and surface_testSurfaceConversion().
#define SDL_SaveBMP | ( | surface, | |
file | |||
) | SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) |
Save a surface to a file.
Convenience macro.
Definition at line 199 of file SDL_surface.h.
Referenced by SDLTest_CompareSurfaces(), SDLTest_ScreenShot(), and surface_testSaveLoadBitmap().
#define SDL_SWSURFACE 0 |
Just here for compatibility
Definition at line 52 of file SDL_surface.h.
Referenced by _surfaceSetUp(), SDLgfx_rotateSurface(), SDLTest_DrawCharacter(), and SW_RenderCopyEx().
typedef int(* SDL_blit) (struct SDL_Surface *src, SDL_Rect *srcrect, struct SDL_Surface *dst, SDL_Rect *dstrect) |
The type of function used for surface blitting functions.
Definition at line 97 of file SDL_surface.h.
int SDL_ConvertPixels | ( | int | width, |
int | height, | ||
Uint32 | src_format, | ||
const void * | src, | ||
int | src_pitch, | ||
Uint32 | dst_format, | ||
void * | dst, | ||
int | dst_pitch | ||
) |
Copy a block of pixels of one format to another format.
Definition at line 1022 of file SDL_surface.c.
References SDL_Rect::h, i, rect, SDL_BYTESPERPIXEL, SDL_CreateSurfaceOnStack(), SDL_InvalidParamError, SDL_ISPIXELFORMAT_FOURCC, SDL_LowerBlit(), SDL_memcpy, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
SDL_Surface* SDL_ConvertSurface | ( | SDL_Surface * | src, |
const SDL_PixelFormat * | fmt, | ||
Uint32 | flags | ||
) |
Creates a new surface of the specified format, and then copies and maps the given surface to it so the blit of the converted surface will be as fast as possible. If this function fails, it returns NULL.
The flags
parameter is passed to SDL_CreateRGBSurface() and has those semantics. You can also pass SDL_RLEACCEL in the flags parameter and SDL will try to RLE accelerate colorkey and alpha blits in the resulting surface.
Definition at line 842 of file SDL_surface.c.
References SDL_BlitInfo::a, SDL_Color::a, SDL_PixelFormat::Amask, SDL_BlitInfo::b, SDL_Color::b, SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::Bmask, SDL_Surface::clip_rect, SDL_BlitInfo::colorkey, SDL_Palette::colors, SDL_BlitInfo::flags, SDL_Surface::format, SDL_BlitInfo::g, SDL_Color::g, SDL_PixelFormat::Gmask, SDL_Rect::h, SDL_Surface::h, i, SDL_BlitMap::info, SDL_Surface::map, SDL_Palette::ncolors, NULL, SDL_PixelFormat::palette, SDL_BlitInfo::r, SDL_Color::r, SDL_PixelFormat::Rmask, SDL_BLENDMODE_BLEND, SDL_ConvertColorkeyToAlpha(), SDL_COPY_BLEND, SDL_COPY_COLORKEY, SDL_COPY_MODULATE_ALPHA, SDL_COPY_RLE_ALPHAKEY, SDL_COPY_RLE_COLORKEY, SDL_COPY_RLE_DESIRED, SDL_CreateRGBSurface(), SDL_FALSE, SDL_GetRGBA, SDL_InvalidateMap(), SDL_LowerBlit(), SDL_MapRGBA, SDL_memcmp, SDL_memcpy, SDL_RLEACCEL, SDL_SetClipRect(), SDL_SetColorKey(), SDL_SetError, SDL_SetSurfaceBlendMode(), SDL_SetSurfaceRLE(), SDL_TRUE, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_ConvertSurfaceFormat().
SDL_Surface* SDL_ConvertSurfaceFormat | ( | SDL_Surface * | src, |
Uint32 | pixel_format, | ||
Uint32 | flags | ||
) |
Definition at line 966 of file SDL_surface.c.
References NULL, SDL_AllocFormat, SDL_ConvertSurface(), SDL_FreeFormat, and SDL_INLINE.
SDL_Surface* SDL_CreateRGBSurface | ( | Uint32 | flags, |
int | width, | ||
int | height, | ||
int | depth, | ||
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Allocate and free an RGB surface.
If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater than 8 bits, the pixel format is set using the flags '[RGB]mask'.
If the function runs out of memory, it will return NULL.
flags | The flags are obsolete and should be set to 0. |
width | The width in pixels of the surface to create. |
height | The height in pixels of the surface to create. |
depth | The depth in bits of the surface to create. |
Rmask | The red mask of the surface to create. |
Gmask | The green mask of the surface to create. |
Bmask | The blue mask of the surface to create. |
Amask | The alpha mask of the surface to create. |
Definition at line 34 of file SDL_surface.c.
References SDL_Color::b, SDL_PixelFormat::BitsPerPixel, SDL_Palette::colors, SDL_Surface::format, SDL_PixelFormat::format, SDL_Color::g, SDL_Surface::h, SDL_Surface::map, SDL_Palette::ncolors, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_Color::r, SDL_Surface::refcount, SDL_AllocBlitMap(), SDL_AllocFormat, SDL_AllocPalette, SDL_BLENDMODE_BLEND, SDL_CalculatePitch(), SDL_calloc(), SDL_FreePalette, SDL_FreeSurface(), SDL_ISPIXELFORMAT_INDEXED, SDL_malloc, SDL_MasksToPixelFormatEnum, SDL_memset, SDL_OutOfMemory, SDL_PIXELFORMAT_UNKNOWN, SDL_SetClipRect(), SDL_SetError, SDL_SetSurfaceBlendMode(), SDL_SetSurfacePalette(), void, and SDL_Surface::w.
Referenced by SDL_ConvertSurface(), and SDL_CreateRGBSurfaceFrom().
SDL_Surface* SDL_CreateRGBSurfaceFrom | ( | void * | pixels, |
int | width, | ||
int | height, | ||
int | depth, | ||
int | pitch, | ||
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Definition at line 121 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::h, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_CreateRGBSurface(), SDL_PREALLOC, SDL_SetClipRect(), and SDL_Surface::w.
int SDL_FillRect | ( | SDL_Surface * | dst, |
const SDL_Rect * | rect, | ||
Uint32 | color | ||
) |
Performs a fast fill of the given rectangle with color
.
If rect
is NULL, the whole surface will be filled with color
.
The color should be a pixel of the format used by the surface, and can be generated by the SDL_MapRGB() function.
Definition at line 237 of file SDL_fillrect.c.
References SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::BytesPerPixel, SDL_Surface::clip_rect, SDL_Surface::format, SDL_Rect::h, SDL_Surface::pitch, SDL_Surface::pixels, SDL_FillRect1(), SDL_FillRect2(), SDL_FillRect3(), SDL_FillRect4(), SDL_HasSSE, SDL_IntersectRect, SDL_RectEmpty(), SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_FillRects().
int SDL_FillRects | ( | SDL_Surface * | dst, |
const SDL_Rect * | rects, | ||
int | count, | ||
Uint32 | color | ||
) |
Definition at line 327 of file SDL_fillrect.c.
References i, SDL_FillRect(), and SDL_SetError.
void SDL_FreeSurface | ( | SDL_Surface * | surface | ) |
Definition at line 1116 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::format, SDL_Surface::locked, SDL_Surface::map, NULL, SDL_Surface::pixels, SDL_Surface::refcount, SDL_DONTFREE, SDL_free(), SDL_FreeBlitMap(), SDL_FreeFormat, SDL_PREALLOC, SDL_RLEACCEL, SDL_SetSurfacePalette(), SDL_UnlockSurface(), and SDL_UnRLESurface().
Referenced by SDL_CreateRGBSurface().
void SDL_GetClipRect | ( | SDL_Surface * | surface, |
SDL_Rect * | rect | ||
) |
Gets the clipping rectangle for the destination surface in a blit.
rect
must be a pointer to a valid rectangle which will be filled with the correct values.
Definition at line 481 of file SDL_surface.c.
References SDL_Surface::clip_rect.
int SDL_GetColorKey | ( | SDL_Surface * | surface, |
Uint32 * | key | ||
) |
Gets the color key (transparent pixel) in a blittable surface.
surface | The surface to update |
key | A pointer filled in with the transparent pixel in the native surface format |
Definition at line 222 of file SDL_surface.c.
References SDL_BlitInfo::colorkey, SDL_BlitInfo::flags, SDL_BlitMap::info, SDL_Surface::map, and SDL_COPY_COLORKEY.
int SDL_GetSurfaceAlphaMod | ( | SDL_Surface * | surface, |
Uint8 * | alpha | ||
) |
Get the additional alpha value used in blit operations.
surface | The surface to query. |
alpha | A pointer filled in with the current alpha value. |
Definition at line 378 of file SDL_surface.c.
References SDL_BlitInfo::a, SDL_BlitMap::info, and SDL_Surface::map.
int SDL_GetSurfaceBlendMode | ( | SDL_Surface * | surface, |
SDL_BlendMode * | blendMode | ||
) |
Get the blend mode used for blit operations.
surface | The surface to query. |
blendMode | A pointer filled in with the current blend mode. |
Definition at line 428 of file SDL_surface.c.
References SDL_Surface::map, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_NONE, SDL_COPY_ADD, SDL_COPY_BLEND, and SDL_COPY_MOD.
int SDL_GetSurfaceColorMod | ( | SDL_Surface * | surface, |
Uint8 * | r, | ||
Uint8 * | g, | ||
Uint8 * | b | ||
) |
Get the additional color value used in blit operations.
surface | The surface to query. |
r | A pointer filled in with the current red color value. |
g | A pointer filled in with the current green color value. |
b | A pointer filled in with the current blue color value. |
Definition at line 336 of file SDL_surface.c.
References SDL_BlitInfo::b, SDL_BlitInfo::g, SDL_BlitMap::info, SDL_Surface::map, and SDL_BlitInfo::r.
SDL_Surface* SDL_LoadBMP_RW | ( | SDL_RWops * | src, |
int | freesrc | ||
) |
Load a surface from a seekable SDL data stream (memory or file).
If freesrc
is non-zero, the stream will be closed after being read.
The new surface should be freed with SDL_FreeSurface().
Definition at line 81 of file SDL_bmp.c.
References SDL_Color::a, SDL_Color::b, BI_BITFIELDS, BI_RGB, colors, SDL_Palette::colors, CorrectAlphaChannel(), done, SDL_Surface::format, SDL_Color::g, SDL_Surface::h, i, SDL_Palette::ncolors, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_Color::r, RW_SEEK_CUR, RW_SEEK_SET, SDL_ALPHA_OPAQUE, SDL_assert, SDL_ClearError, SDL_CreateRGBSurface, SDL_EFREAD, SDL_EFSEEK, SDL_Error, SDL_FALSE, SDL_FreeSurface, SDL_GetError, SDL_OutOfMemory, SDL_ReadLE16, SDL_ReadLE32, SDL_realloc, SDL_RWclose, SDL_RWread, SDL_RWseek, SDL_RWtell, SDL_SetError, SDL_strcmp, SDL_strncmp, SDL_Swap16(), SDL_Swap32(), SDL_TRUE, and SDL_Surface::w.
int SDL_LockSurface | ( | SDL_Surface * | surface | ) |
Sets 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.
No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time.
SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
Definition at line 803 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::locked, SDL_RLEACCEL, and SDL_UnRLESurface().
Referenced by SDL_ConvertColorkeyToAlpha().
int SDL_LowerBlit | ( | SDL_Surface * | src, |
SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
SDL_Rect * | dstrect | ||
) |
This is a semi-private blit function and it performs low-level surface blitting only.
Definition at line 500 of file SDL_surface.c.
References SDL_BlitMap::blit, SDL_BlitMap::dst, SDL_BlitMap::dst_palette_version, SDL_Surface::format, SDL_Surface::map, SDL_PixelFormat::palette, SDL_MapSurface(), SDL_BlitMap::src_palette_version, and SDL_Palette::version.
Referenced by SDL_ConvertPixels(), SDL_ConvertSurface(), SDL_LowerBlitScaled(), and SDL_UpperBlit().
int SDL_LowerBlitScaled | ( | SDL_Surface * | src, |
SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
SDL_Rect * | dstrect | ||
) |
This is a semi-private blit function and it performs low-level surface scaled blitting only.
Definition at line 776 of file SDL_surface.c.
References SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::format, SDL_BlitMap::info, SDL_Surface::map, SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_COLORKEY, SDL_COPY_MOD, SDL_COPY_MODULATE_ALPHA, SDL_COPY_MODULATE_COLOR, SDL_COPY_NEAREST, SDL_InvalidateMap(), SDL_ISPIXELFORMAT_INDEXED, SDL_LowerBlit(), and SDL_SoftStretch.
Referenced by SDL_UpperBlitScaled().
int SDL_SaveBMP_RW | ( | SDL_Surface * | surface, |
SDL_RWops * | dst, | ||
int | freedst | ||
) |
Save a surface to a seekable SDL data stream (memory or file).
If freedst
is non-zero, the stream will be closed after being written.
Definition at line 454 of file SDL_bmp.c.
References SDL_PixelFormat::Amask, BI_RGB, SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, colors, SDL_Palette::colors, SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::Gmask, SDL_Surface::h, i, SDL_BlitMap::info, SDL_Surface::map, SDL_Palette::ncolors, NULL, SDL_PixelFormat::palette, SDL_Surface::pitch, SDL_Surface::pixels, SDL_PixelFormat::Rmask, RW_SEEK_SET, SDL_BYTEORDER, SDL_ClearError, SDL_ConvertSurface, SDL_COPY_COLORKEY, SDL_EFSEEK, SDL_EFWRITE, SDL_Error, SDL_FALSE, SDL_FreeSurface, SDL_GetError, SDL_InitFormat(), SDL_LIL_ENDIAN, SDL_LockSurface, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_BGRA8888, SDL_RWclose, SDL_RWseek, SDL_RWtell, SDL_RWwrite, SDL_SetError, SDL_strcmp, SDL_TRUE, SDL_UnlockSurface, SDL_WriteLE16, SDL_WriteLE32, and SDL_Surface::w.
SDL_bool SDL_SetClipRect | ( | SDL_Surface * | surface, |
const SDL_Rect * | rect | ||
) |
Sets the clipping rectangle for the destination surface in a blit.
If the clip rectangle is NULL, clipping will be disabled.
If the clip rectangle doesn't intersect the surface, the function will return SDL_FALSE and blits will be completely clipped. Otherwise the function returns SDL_TRUE and blits to the surface will be clipped to the intersection of the surface area and the clipping rectangle.
Note that blits are automatically clipped to the edges of the source and destination surfaces.
Definition at line 457 of file SDL_surface.c.
References SDL_Surface::clip_rect, SDL_Rect::h, SDL_Surface::h, SDL_FALSE, SDL_IntersectRect, SDL_TRUE, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_ConvertSurface(), SDL_CreateRGBSurface(), and SDL_CreateRGBSurfaceFrom().
int SDL_SetColorKey | ( | SDL_Surface * | surface, |
int | flag, | ||
Uint32 | key | ||
) |
Sets the color key (transparent pixel) in a blittable surface.
surface | The surface to update |
flag | Non-zero to enable colorkey and 0 to disable colorkey |
key | The transparent pixel in the native surface format |
You can pass SDL_RLEACCEL to enable RLE accelerated blits.
Definition at line 177 of file SDL_surface.c.
References SDL_Color::a, SDL_BlitInfo::colorkey, SDL_Palette::colors, SDL_BlitInfo::flags, SDL_Surface::format, SDL_BlitMap::info, SDL_Surface::map, SDL_Palette::ncolors, SDL_PixelFormat::palette, SDL_ALPHA_OPAQUE, SDL_ALPHA_TRANSPARENT, SDL_COPY_COLORKEY, SDL_InvalidateMap(), SDL_InvalidParamError, SDL_RLEACCEL, SDL_SetSurfaceRLE(), and SDL_Palette::version.
Referenced by SDL_ConvertColorkeyToAlpha(), and SDL_ConvertSurface().
int SDL_SetSurfaceAlphaMod | ( | SDL_Surface * | surface, |
Uint8 | alpha | ||
) |
Set an additional alpha value used in blit operations.
surface | The surface to update. |
alpha | The alpha value multiplied into blit operations. |
Definition at line 355 of file SDL_surface.c.
References SDL_BlitInfo::a, SDL_BlitInfo::flags, SDL_BlitMap::info, SDL_Surface::map, SDL_COPY_MODULATE_ALPHA, and SDL_InvalidateMap().
int SDL_SetSurfaceBlendMode | ( | SDL_Surface * | surface, |
SDL_BlendMode | blendMode | ||
) |
Set the blend mode used for blit operations.
surface | The surface to update. |
blendMode | SDL_BlendMode to use for blit blending. |
Definition at line 391 of file SDL_surface.c.
References SDL_BlitInfo::flags, SDL_BlitMap::info, SDL_Surface::map, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_NONE, SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_MOD, SDL_InvalidateMap(), and SDL_Unsupported.
Referenced by SDL_ConvertColorkeyToAlpha(), SDL_ConvertSurface(), and SDL_CreateRGBSurface().
int SDL_SetSurfaceColorMod | ( | SDL_Surface * | surface, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
Set an additional color value used in blit operations.
surface | The surface to update. |
r | The red color value multiplied into blit operations. |
g | The green color value multiplied into blit operations. |
b | The blue color value multiplied into blit operations. |
Definition at line 310 of file SDL_surface.c.
References SDL_BlitInfo::b, SDL_BlitInfo::flags, SDL_BlitInfo::g, SDL_BlitMap::info, SDL_Surface::map, SDL_BlitInfo::r, SDL_COPY_MODULATE_COLOR, and SDL_InvalidateMap().
int SDL_SetSurfacePalette | ( | SDL_Surface * | surface, |
SDL_Palette * | palette | ||
) |
Set the palette used by a surface.
Definition at line 142 of file SDL_surface.c.
References SDL_Surface::format, SDL_Surface::map, SDL_InvalidateMap(), SDL_SetError, and SDL_SetPixelFormatPalette.
Referenced by SDL_CreateRGBSurface(), and SDL_FreeSurface().
int SDL_SetSurfaceRLE | ( | SDL_Surface * | surface, |
int | flag | ||
) |
Sets the RLE acceleration hint for a surface.
Definition at line 156 of file SDL_surface.c.
References SDL_BlitInfo::flags, SDL_BlitMap::info, SDL_Surface::map, SDL_COPY_RLE_DESIRED, and SDL_InvalidateMap().
Referenced by SDL_ConvertSurface(), and SDL_SetColorKey().
int SDL_SoftStretch | ( | SDL_Surface * | src, |
const SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
const SDL_Rect * | dstrect | ||
) |
Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
Definition at line 203 of file SDL_stretch.c.
References SDL_PixelFormat::BytesPerPixel, copy_row3(), SDL_Surface::format, SDL_PixelFormat::format, SDL_Rect::h, SDL_Surface::h, NULL, SDL_Surface::pitch, SDL_Surface::pixels, pop, SDL_FALSE, SDL_LockSurface, SDL_MUSTLOCK, SDL_SetError, SDL_TRUE, SDL_UnlockSurface, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
void SDL_UnlockSurface | ( | SDL_Surface * | surface | ) |
Definition at line 824 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::locked, SDL_RLEACCEL, and SDL_RLESurface().
Referenced by SDL_ConvertColorkeyToAlpha(), and SDL_FreeSurface().
int SDL_UpperBlit | ( | SDL_Surface * | src, |
const SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
SDL_Rect * | dstrect | ||
) |
This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit()
Definition at line 523 of file SDL_surface.c.
References SDL_Surface::clip_rect, SDL_BlitInfo::flags, SDL_Rect::h, SDL_Surface::h, SDL_BlitMap::info, SDL_Surface::locked, SDL_Surface::map, NULL, SDL_COPY_NEAREST, SDL_InvalidateMap(), SDL_LowerBlit(), SDL_SetError, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
int SDL_UpperBlitScaled | ( | SDL_Surface * | src, |
const SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
SDL_Rect * | dstrect | ||
) |
This is the public scaled blit function, SDL_BlitScaled(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
Definition at line 622 of file SDL_surface.c.
References SDL_Surface::clip_rect, SDL_Rect::h, SDL_Surface::h, SDL_Surface::locked, NULL, SDL_BlitSurface, SDL_floor, SDL_LowerBlitScaled(), SDL_SetError, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.