Go to the source code of this file.
|
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) |
| |
| #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 |
| |
| 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 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...
|
| |
| SDL_Surface * | SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
| |
| SDL_Surface * | SDL_CreateRGBSurfaceWithFormat (Uint32 flags, int width, int height, int depth, Uint32 format) |
| |
| SDL_Surface * | SDL_CreateRGBSurfaceFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
| |
| SDL_Surface * | SDL_CreateRGBSurfaceWithFormatFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 format) |
| |
| 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...
|
| |
| SDL_bool | SDL_HasColorKey (SDL_Surface *surface) |
| | Returns whether the surface has a color key. 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_DuplicateSurface (SDL_Surface *surface) |
| |
| 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) |
| |
| void | SDL_SetYUVConversionMode (SDL_YUV_CONVERSION_MODE mode) |
| | Set the YUV conversion mode. More...
|
| |
| SDL_YUV_CONVERSION_MODE | SDL_GetYUVConversionMode (void) |
| | Get the YUV conversion mode. More...
|
| |
| SDL_YUV_CONVERSION_MODE | SDL_GetYUVConversionModeForResolution (int width, int height) |
| | Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC. More...
|
| |
Header file for SDL_Surface definition and management functions.
Definition in file SDL_surface.h.
◆ SDL_BlitScaled
◆ SDL_BlitSurface
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.
- Returns
- 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.
Definition at line 485 of file SDL_surface.h.
◆ SDL_DONTFREE
| #define SDL_DONTFREE 0x00000004 |
Surface is referenced internally
Definition at line 56 of file SDL_surface.h.
◆ SDL_LoadBMP
Load a surface from a file.
Convenience macro.
Definition at line 202 of file SDL_surface.h.
◆ SDL_MUSTLOCK
Evaluates to true if the surface needs to be locked before access.
Definition at line 63 of file SDL_surface.h.
◆ SDL_PREALLOC
| #define SDL_PREALLOC 0x00000001 |
Surface uses preallocated memory
Definition at line 54 of file SDL_surface.h.
◆ SDL_RLEACCEL
| #define SDL_RLEACCEL 0x00000002 |
◆ SDL_SaveBMP
Save a surface to a file.
Convenience macro.
Definition at line 225 of file SDL_surface.h.
◆ SDL_SIMD_ALIGNED
| #define SDL_SIMD_ALIGNED 0x00000008 |
◆ SDL_SWSURFACE
◆ SDL_blit
The type of function used for surface blitting functions.
Definition at line 98 of file SDL_surface.h.
◆ SDL_YUV_CONVERSION_MODE
The formula used for converting between YUV and RGB.
| Enumerator |
|---|
| SDL_YUV_CONVERSION_JPEG | Full range JPEG
|
| SDL_YUV_CONVERSION_BT601 | BT.601 (the default)
|
| SDL_YUV_CONVERSION_BT709 | BT.709
|
| SDL_YUV_CONVERSION_AUTOMATIC | BT.601 for SD content, BT.709 for HD content
|
Definition at line 104 of file SDL_surface.h.
◆ SDL_ConvertPixels()
| 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.
- Returns
- 0 on success, or -1 if there was an error
Definition at line 1242 of file SDL_surface.c.
1250 void *nonconst_src = (
void *)
src;
1276 if (src_format == dst_format) {
1290 &src_surface, &src_fmt, &src_blitmap)) {
1294 &dst_surface, &dst_fmt, &dst_blitmap)) {
References bpp, SDL_Rect::h, i, rect, SDL_BYTESPERPIXEL, SDL_ConvertPixels_RGB_to_YUV(), SDL_ConvertPixels_YUV_to_RGB(), SDL_ConvertPixels_YUV_to_YUV(), SDL_CreateSurfaceOnStack(), SDL_InvalidParamError, SDL_ISPIXELFORMAT_FOURCC, SDL_LowerBlit(), SDL_memcpy, SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ SDL_ConvertSurface()
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 957 of file SDL_surface.c.
966 int palette_ck_value = 0;
982 for (
i = 0;
i <
format->palette->ncolors; ++
i) {
983 if ((
format->palette->colors[
i].r != 0xFF) ||
984 (
format->palette->colors[
i].g != 0xFF) ||
985 (
format->palette->colors[
i].b != 0xFF))
988 if (
i ==
format->palette->ncolors) {
999 if (convert ==
NULL) {
1012 copy_flags =
surface->map->info.flags;
1013 copy_color.
r =
surface->map->info.r;
1014 copy_color.
g =
surface->map->info.g;
1015 copy_color.
b =
surface->map->info.b;
1016 copy_color.
a =
surface->map->info.a;
1037 for (
i = 0;
i <
surface->format->palette->ncolors;
i++) {
1047 if (alpha_value == 0) {
1057 for (
i = 0;
i <
surface->format->palette->ncolors;
i++) {
1058 palette_saved_alpha[
i] =
surface->format->palette->colors[
i].a;
1069 palette_ck_value =
surface->format->palette->colors[
surface->map->info.colorkey].a;
1077 if (palette_ck_transform) {
1078 surface->format->palette->colors[
surface->map->info.colorkey].a = palette_ck_value;
1082 if (palette_saved_alpha) {
1084 for (
i = 0;
i <
surface->format->palette->ncolors;
i++) {
1085 surface->format->palette->colors[
i].a = palette_saved_alpha[
i];
1100 surface->map->info.r = copy_color.
r;
1101 surface->map->info.g = copy_color.
g;
1102 surface->map->info.b = copy_color.
b;
1103 surface->map->info.a = copy_color.
a;
1104 surface->map->info.flags = copy_flags;
1116 if (
surface->format->palette) {
1118 surface->format->palette->ncolors <=
format->palette->ncolors &&
1123 }
else if (!
format->palette) {
1132 if (set_colorkey_by_color) {
1135 int converted_colorkey = 0;
1144 if (
surface->format->palette) {
1173 (palette_has_alpha &&
format->Amask) ||
References SDL_BlitInfo::a, SDL_Color::a, SDL_BlitInfo::b, SDL_Color::b, SDL_PixelFormat::BytesPerPixel, SDL_Surface::clip_rect, SDL_BlitInfo::colorkey, SDL_Palette::colors, SDL_BlitInfo::flags, SDL_Surface::format, SDL_BlitInfo::g, SDL_Color::g, SDL_Rect::h, i, SDL_BlitMap::info, SDL_Surface::map, SDL_Palette::ncolors, NULL, SDL_PixelFormat::palette, SDL_Surface::pixels, SDL_BlitInfo::r, SDL_Color::r, SDL_ALPHA_OPAQUE, SDL_ALPHA_TRANSPARENT, 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_FillRect, SDL_FreeSurface(), SDL_InvalidateMap(), SDL_InvalidParamError, SDL_LowerBlit(), SDL_memcmp, SDL_memcpy, SDL_RLEACCEL, SDL_SetClipRect(), SDL_SetColorKey(), SDL_SetError, SDL_SetSurfaceBlendMode(), SDL_SetSurfacePalette(), SDL_SetSurfaceRLE(), SDL_stack_alloc, SDL_stack_free, SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_ConvertSurfaceFormat(), and SDL_DuplicateSurface().
◆ SDL_ConvertSurfaceFormat()
◆ SDL_CreateRGBSurface()
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.
- Parameters
-
| 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 147 of file SDL_surface.c.
References NULL, SDL_CreateRGBSurfaceWithFormat(), SDL_MasksToPixelFormatEnum, SDL_PIXELFORMAT_UNKNOWN, and SDL_SetError.
Referenced by SDL_ConvertSurface(), and SDL_CreateRGBSurfaceFrom().
◆ SDL_CreateRGBSurfaceFrom()
◆ SDL_CreateRGBSurfaceWithFormat()
Definition at line 59 of file SDL_surface.c.
References SDL_Color::b, SDL_Palette::colors, SDL_Color::g, SDL_Palette::ncolors, NULL, SDL_Color::r, SDL_AllocBlitMap(), SDL_AllocFormat, SDL_AllocPalette, SDL_BLENDMODE_BLEND, SDL_CalculatePitch(), SDL_calloc, SDL_FreePalette, SDL_FreeSurface(), SDL_ISPIXELFORMAT_INDEXED, SDL_MAX_SINT32, SDL_memset, SDL_OutOfMemory, SDL_SetClipRect(), SDL_SetSurfaceBlendMode(), SDL_SetSurfacePalette(), SDL_SIMD_ALIGNED, SDL_SIMDAlloc, and void.
Referenced by SDL_CreateRGBSurface(), and SDL_CreateRGBSurfaceWithFormatFrom().
◆ SDL_CreateRGBSurfaceWithFormatFrom()
| SDL_Surface* SDL_CreateRGBSurfaceWithFormatFrom |
( |
void * |
pixels, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
depth, |
|
|
int |
pitch, |
|
|
Uint32 |
format |
|
) |
| |
◆ SDL_DuplicateSurface()
◆ SDL_FillRect()
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.
- Returns
- 0 on success, or -1 on error.
Definition at line 238 of file SDL_fillrect.c.
References rect, SDL_FillRects(), SDL_RectEmpty(), and SDL_SetError.
◆ SDL_FillRects()
Definition at line 299 of file SDL_fillrect.c.
313 if (
dst->format->BitsPerPixel < 8) {
314 return SDL_SetError(
"SDL_FillRect(): Unsupported surface format");
319 return SDL_SetError(
"SDL_FillRect(): You must lock the surface");
323 return SDL_SetError(
"SDL_FillRects() passed NULL rects");
326 #if SDL_ARM_NEON_BLITTERS
328 switch (
dst->format->BytesPerPixel) {
330 fill_function = fill_8_neon;
333 fill_function = fill_16_neon;
336 fill_function = fill_32_neon;
341 #if SDL_ARM_SIMD_BLITTERS
343 switch (
dst->format->BytesPerPixel) {
345 fill_function = fill_8_simd;
348 fill_function = fill_16_simd;
351 fill_function = fill_32_simd;
357 if (fill_function ==
NULL) {
358 switch (
dst->format->BytesPerPixel) {
365 fill_function = SDL_FillRect1SSE;
378 fill_function = SDL_FillRect2SSE;
397 fill_function = SDL_FillRect4SSE;
419 rect->
x *
dst->format->BytesPerPixel;
References SDL_Rect::h, i, NULL, rect, SDL_FillRect1(), SDL_FillRect2(), SDL_FillRect3(), SDL_FillRect4(), SDL_HasARMSIMD, SDL_HasNEON, SDL_HasSSE, SDL_IntersectRect, SDL_SetError, void, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_FillRect().
◆ SDL_FreeSurface()
Definition at line 1310 of file SDL_surface.c.
1320 if (--
surface->refcount > 0) {
References NULL, SDL_DONTFREE, SDL_free, SDL_FreeBlitMap(), SDL_FreeFormat, SDL_InvalidateMap(), SDL_PREALLOC, SDL_RLEACCEL, SDL_SetSurfacePalette(), SDL_SIMD_ALIGNED, SDL_SIMDFree, SDL_UnlockSurface(), and SDL_UnRLESurface().
Referenced by SDL_ConvertSurface(), and SDL_CreateRGBSurfaceWithFormat().
◆ SDL_GetClipRect()
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 583 of file SDL_surface.c.
References rect.
◆ SDL_GetColorKey()
Gets the color key (transparent pixel) in a blittable surface.
- Parameters
-
| surface | The surface to update |
| key | A pointer filled in with the transparent pixel in the native surface format |
- Returns
- 0 on success, or -1 if the surface is not valid or colorkey is not enabled.
Definition at line 290 of file SDL_surface.c.
References SDL_COPY_COLORKEY, SDL_InvalidParamError, and SDL_SetError.
◆ SDL_GetSurfaceAlphaMod()
Get the additional alpha value used in blit operations.
- Parameters
-
| surface | The surface to query. |
| alpha | A pointer filled in with the current alpha value. |
- Returns
- 0 on success, or -1 if the surface is not valid.
- See also
- SDL_SetSurfaceAlphaMod()
Definition at line 474 of file SDL_surface.c.
◆ SDL_GetSurfaceBlendMode()
Get the blend mode used for blit operations.
- Parameters
-
| surface | The surface to query. |
| blendMode | A pointer filled in with the current blend mode. |
- Returns
- 0 on success, or -1 if the surface is not valid.
- See also
- SDL_SetSurfaceBlendMode()
Definition at line 527 of file SDL_surface.c.
References blendMode, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_MUL, SDL_BLENDMODE_NONE, SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_MOD, and SDL_COPY_MUL.
◆ SDL_GetSurfaceColorMod()
Get the additional color value used in blit operations.
- Parameters
-
| 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. |
- Returns
- 0 on success, or -1 if the surface is not valid.
- See also
- SDL_SetSurfaceColorMod()
Definition at line 432 of file SDL_surface.c.
◆ SDL_GetYUVConversionMode()
◆ SDL_GetYUVConversionModeForResolution()
◆ SDL_HasColorKey()
◆ SDL_LoadBMP_RW()
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().
- Returns
- the new surface, or NULL if there was an error.
Definition at line 173 of file SDL_bmp.c.
252 }
else if (biSize >= 40) {
305 if (biSize > headerSize) {
309 if (biWidth <= 0 || biHeight == 0) {
310 SDL_SetError(
"BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
316 biHeight = -biHeight;
328 switch (biBitCount) {
331 ExpandBMP = biBitCount;
340 SDL_SetError(
"%d-bpp BMP images are not supported", biBitCount);
349 switch (biCompression) {
355 switch (biBitCount) {
363 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
403 palette = (
surface->format)->palette;
416 biClrUsed = 1 << biBitCount;
419 for (
i = 0;
i < (int) biClrUsed; ++
i) {
426 for (
i = 0;
i < (int) biClrUsed; ++
i) {
457 bmpPitch = (biWidth + 7) >> 3;
458 pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
461 bmpPitch = (biWidth + 1) >> 1;
462 pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
478 int shift = (8 - ExpandBMP);
480 if (
i % (8 / ExpandBMP) == 0) {
487 bits[
i] = (pixel >> shift);
488 if (
bits[
i] >= biClrUsed) {
489 SDL_SetError(
"A BMP image contains a pixel with a color out of the palette");
504 if (biBitCount == 8 && palette && biClrUsed < (1u << biBitCount)) {
506 if (
bits[
i] >= biClrUsed) {
507 SDL_SetError(
"A BMP image contains a pixel with a color out of the palette");
513 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
516 switch (biBitCount) {
538 for (
i = 0;
i < pad; ++
i) {
561 if (freesrc &&
src) {
References SDL_Color::a, SDL_Color::b, BI_BITFIELDS, BI_RGB, BI_RLE4, BI_RLE8, SDL_Palette::colors, CorrectAlphaChannel(), done, SDL_Color::g, i, SDL_Palette::ncolors, NULL, SDL_Color::r, readRlePixels(), 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_ReadLE16, SDL_ReadLE32, SDL_RWclose, SDL_RWread, SDL_RWseek, SDL_RWtell, SDL_SetError, SDL_strcmp, SDL_strncmp, SDL_Swap16(), SDL_Swap32(), and SDL_TRUE.
◆ SDL_LockSurface()
◆ SDL_LowerBlit()
◆ SDL_LowerBlitScaled()
This is a semi-private blit function and it performs low-level surface scaled blitting only.
Definition at line 878 of file SDL_surface.c.
881 static const Uint32 complex_copy_flags = (
892 if ( !(
src->map->info.flags & complex_copy_flags) &&
893 src->format->format ==
dst->format->format &&
References SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_COLORKEY, SDL_COPY_MOD, SDL_COPY_MODULATE_ALPHA, SDL_COPY_MODULATE_COLOR, SDL_COPY_MUL, SDL_COPY_NEAREST, SDL_InvalidateMap(), SDL_ISPIXELFORMAT_INDEXED, SDL_LowerBlit(), and SDL_SoftStretch.
Referenced by SDL_UpperBlitScaled().
◆ SDL_SaveBMP_RW()
Save a surface to a seekable SDL data stream (memory or file).
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.
If freedst is non-zero, the stream will be closed after being written.
- Returns
- 0 if successful or -1 if there was an error.
Definition at line 568 of file SDL_bmp.c.
578 char magic[2] = {
'B',
'M' };
603 Sint32 bV4Endpoints[3 * 3] = {0};
611 #ifdef SAVE_32BIT_BMP
613 if (saveme->format->BitsPerPixel >= 8 && (saveme->format->Amask ||
619 if (saveme->format->palette && !save32bit) {
620 if (saveme->format->BitsPerPixel == 8) {
624 saveme->format->BitsPerPixel);
626 }
else if ((saveme->format->BitsPerPixel == 24) && !save32bit &&
628 (saveme->format->Rmask == 0x00FF0000) &&
629 (saveme->format->Gmask == 0x0000FF00) &&
630 (saveme->format->Bmask == 0x000000FF)
632 (saveme->format->Rmask == 0x000000FF) &&
633 (saveme->format->Gmask == 0x0000FF00) &&
634 (saveme->format->Bmask == 0x00FF0000)
687 biBitCount =
surface->format->BitsPerPixel;
692 if (
surface->format->palette) {
693 biClrUsed =
surface->format->palette->ncolors;
700 if (save32bit && !saveLegacyBMP) {
704 bV4RedMask = 0x00ff0000;
705 bV4GreenMask = 0x0000ff00;
706 bV4BlueMask = 0x000000ff;
707 bV4AlphaMask = 0xff000000;
728 if (save32bit && !saveLegacyBMP) {
734 for (
i = 0;
i < 3 * 3;
i++) {
743 if (
surface->format->palette) {
748 ncolors =
surface->format->palette->ncolors;
749 for (
i = 0;
i < ncolors; ++
i) {
769 pad = ((bw % 4) ? (4 - (bw % 4)) : 0);
777 const Uint8 padbyte = 0;
778 for (
i = 0;
i < pad; ++
i) {
801 if (freedst &&
dst) {
References SDL_PixelFormat::Amask, BI_BITFIELDS, BI_RGB, SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::Bmask, colors, endif, SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::Gmask, i, SDL_BlitMap::info, LCS_WINDOWS_COLOR_SPACE, SDL_Surface::map, NULL, SDL_PixelFormat::palette, 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_GetHintBoolean, SDL_HINT_BMP_SAVE_LEGACY_FORMAT, SDL_InitFormat(), SDL_LIL_ENDIAN, SDL_LockSurface, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_BGRA32, SDL_RWclose, SDL_RWseek, SDL_RWtell, SDL_RWwrite, SDL_SetError, SDL_strcmp, SDL_TRUE, SDL_UnlockSurface, SDL_WriteLE16, and SDL_WriteLE32.
◆ SDL_SetClipRect()
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 559 of file SDL_surface.c.
576 surface->clip_rect = full_rect;
References SDL_Rect::h, rect, SDL_FALSE, SDL_IntersectRect, SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_ConvertSurface(), SDL_CreateRGBSurfaceFrom(), SDL_CreateRGBSurfaceWithFormat(), and SDL_CreateRGBSurfaceWithFormatFrom().
◆ SDL_SetColorKey()
◆ SDL_SetSurfaceAlphaMod()
◆ SDL_SetSurfaceBlendMode()
Set the blend mode used for blit operations.
- Parameters
-
| surface | The surface to update. |
| blendMode | SDL_BlendMode to use for blit blending. |
- Returns
- 0 on success, or -1 if the parameters are not valid.
- See also
- SDL_GetSurfaceBlendMode()
Definition at line 487 of file SDL_surface.c.
References blendMode, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_MUL, SDL_BLENDMODE_NONE, SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_MOD, SDL_COPY_MUL, SDL_InvalidateMap(), and SDL_Unsupported.
Referenced by SDL_ConvertColorkeyToAlpha(), SDL_ConvertSurface(), and SDL_CreateRGBSurfaceWithFormat().
◆ SDL_SetSurfaceColorMod()
Set an additional color value used in blit operations.
- Parameters
-
| 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. |
- Returns
- 0 on success, or -1 if the surface is not valid.
- See also
- SDL_GetSurfaceColorMod()
Definition at line 406 of file SDL_surface.c.
419 if (
r != 0xFF ||
g != 0xFF ||
b != 0xFF) {
References SDL_COPY_MODULATE_COLOR, and SDL_InvalidateMap().
◆ SDL_SetSurfacePalette()
◆ SDL_SetSurfaceRLE()
| int SDL_SetSurfaceRLE |
( |
SDL_Surface * |
surface, |
|
|
int |
flag |
|
) |
| |
◆ SDL_SetYUVConversionMode()
◆ SDL_SoftStretch()
Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
- Note
- This function uses a static buffer, and is not thread-safe.
Definition at line 203 of file SDL_stretch.c.
210 int src_row, dst_row;
215 #ifdef USE_ASM_STRETCH
221 const int bpp =
dst->format->BytesPerPixel;
223 if (
src->format->format !=
dst->format->format) {
224 return SDL_SetError(
"Only works with same format surfaces");
229 if ((srcrect->
x < 0) || (srcrect->
y < 0) ||
230 ((srcrect->
x + srcrect->
w) >
src->w) ||
231 ((srcrect->
y + srcrect->
h) >
src->h)) {
242 if ((dstrect->
x < 0) || (dstrect->
y < 0) ||
243 ((dstrect->
x + dstrect->
w) >
dst->w) ||
244 ((dstrect->
y + dstrect->
h) >
dst->h)) {
245 return SDL_SetError(
"Invalid destination blit rectangle");
259 return SDL_SetError(
"Unable to lock destination surface");
277 inc = (srcrect->
h << 16) / dstrect->
h;
278 src_row = srcrect->
y;
279 dst_row = dstrect->
y;
281 #ifdef USE_ASM_STRETCH
283 if ((
bpp == 3) || (generate_rowbytes(srcrect->
w, dstrect->
w,
bpp) < 0)) {
289 for (dst_maxrow = dst_row + dstrect->
h; dst_row < dst_maxrow; ++dst_row) {
290 dstp = (
Uint8 *)
dst->pixels + (dst_row *
dst->pitch)
291 + (dstrect->
x *
bpp);
292 while (pos >= 0x10000L) {
293 srcp = (
Uint8 *)
src->pixels + (src_row *
src->pitch)
294 + (srcrect->
x *
bpp);
298 #ifdef USE_ASM_STRETCH
301 __asm__ __volatile__(
"call *%4":
"=&D"(
u1),
"=&S"(
u2)
302 :
"0"(dstp),
"1"(srcp),
"r"(copy_row)
304 #elif defined(_MSC_VER) || defined(__WATCOMC__)
307 void *code = copy_row;
320 #error Need inline assembly for this compiler
326 copy_row1(srcp, srcrect->
w, dstp, dstrect->
w);
329 copy_row2((
Uint16 *) srcp, srcrect->
w,
336 copy_row4((
Uint32 *) srcp, srcrect->
w,
References bpp, copy_row3(), SDL_Rect::h, if, mov, NULL, pop, ptr, SDL_FALSE, SDL_LockSurface, SDL_MUSTLOCK, SDL_SetError, SDL_TRUE, SDL_UnlockSurface, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ SDL_UnlockSurface()
◆ SDL_UpperBlit()
This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit()
Definition at line 625 of file SDL_surface.c.
629 int srcx, srcy,
w,
h;
633 return SDL_SetError(
"SDL_UpperBlit: passed a NULL surface");
635 if (
src->locked ||
dst->locked) {
636 return SDL_SetError(
"Surfaces must not be locked during blit");
640 if (dstrect ==
NULL) {
641 fulldst.
x = fulldst.
y = 0;
658 maxw =
src->w - srcx;
669 maxh =
src->h - srcy;
684 dx = clip->
x - dstrect->
x;
690 dx = dstrect->
x +
w - clip->
x - clip->
w;
694 dy = clip->
y - dstrect->
y;
700 dy = dstrect->
y +
h - clip->
y - clip->
h;
711 if (
w > 0 &&
h > 0) {
715 sr.
w = dstrect->
w =
w;
716 sr.
h = dstrect->
h =
h;
719 dstrect->
w = dstrect->
h = 0;
References SDL_Rect::h, NULL, SDL_COPY_NEAREST, SDL_InvalidateMap(), SDL_LowerBlit(), SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
◆ SDL_UpperBlitScaled()
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 724 of file SDL_surface.c.
727 double src_x0, src_y0, src_x1, src_y1;
728 double dst_x0, dst_y0, dst_x1, dst_y1;
730 double scaling_w, scaling_h;
736 return SDL_SetError(
"SDL_UpperBlitScaled: passed a NULL surface");
738 if (
src->locked ||
dst->locked) {
739 return SDL_SetError(
"Surfaces must not be locked during blit");
742 if (
NULL == srcrect) {
750 if (
NULL == dstrect) {
758 if (dst_w == src_w && dst_h == src_h) {
763 scaling_w = (double)dst_w / src_w;
764 scaling_h = (double)dst_h / src_h;
766 if (
NULL == dstrect) {
774 dst_x1 = dst_x0 + dst_w - 1;
775 dst_y1 = dst_y0 + dst_h - 1;
778 if (
NULL == srcrect) {
786 src_x1 = src_x0 + src_w - 1;
787 src_y1 = src_y0 + src_h - 1;
792 dst_x0 -= src_x0 * scaling_w;
796 if (src_x1 >=
src->w) {
797 dst_x1 -= (src_x1 -
src->w + 1) * scaling_w;
802 dst_y0 -= src_y0 * scaling_h;
806 if (src_y1 >=
src->h) {
807 dst_y1 -= (src_y1 -
src->h + 1) * scaling_h;
815 dst_x0 -=
dst->clip_rect.x;
816 dst_x1 -=
dst->clip_rect.x;
817 dst_y0 -=
dst->clip_rect.y;
818 dst_y1 -=
dst->clip_rect.y;
821 src_x0 -= dst_x0 / scaling_w;
825 if (dst_x1 >=
dst->clip_rect.w) {
826 src_x1 -= (dst_x1 -
dst->clip_rect.w + 1) / scaling_w;
827 dst_x1 =
dst->clip_rect.w - 1;
831 src_y0 -= dst_y0 / scaling_h;
835 if (dst_y1 >=
dst->clip_rect.h) {
836 src_y1 -= (dst_y1 -
dst->clip_rect.h + 1) / scaling_h;
837 dst_y1 =
dst->clip_rect.h - 1;
841 dst_x0 +=
dst->clip_rect.x;
842 dst_x1 +=
dst->clip_rect.x;
843 dst_y0 +=
dst->clip_rect.y;
844 dst_y1 +=
dst->clip_rect.y;
853 final_dst.
w = (int)
SDL_floor(dst_x1 - dst_x0 + 1.5);
854 final_dst.
h = (int)
SDL_floor(dst_y1 - dst_y0 + 1.5);
862 *dstrect = final_dst;
864 if (final_dst.
w == 0 || final_dst.
h == 0 ||
865 final_src.
w <= 0 || final_src.
h <= 0) {
References SDL_Rect::h, NULL, SDL_BlitSurface, SDL_floor, SDL_LowerBlitScaled(), SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
#define SDL_UnlockSurface
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode()
Get the YUV conversion mode.
static SDL_BlendMode blendMode
A collection of pixels used in software blitting.
int SDL_LowerBlit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
#define SDL_YUV_SD_THRESHOLD
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
static void copy_row3(Uint8 *src, int src_w, Uint8 *dst, int dst_w)
#define SDL_COPY_RLE_COLORKEY
GLboolean GLboolean GLboolean b
GLint GLint GLsizei width
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
void SDL_UnRLESurface(SDL_Surface *surface, int recode)
GLuint GLuint GLsizei count
static SDL_INLINE SDL_bool SDL_CreateSurfaceOnStack(int width, int height, Uint32 pixel_format, void *pixels, int pitch, SDL_Surface *surface, SDL_PixelFormat *format, SDL_BlitMap *blitmap)
GLdouble GLdouble GLdouble r
static void SDL_FillRect4(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
#define SDL_MasksToPixelFormatEnum
#define SDL_ConvertSurface
GLdouble GLdouble GLdouble GLdouble top
SDL_BlitMap * SDL_AllocBlitMap(void)
#define SDL_InvalidParamError(param)
int SDL_LowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
#define SDL_IntersectRect
#define SDL_COPY_COLORKEY
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
#define SDL_ISPIXELFORMAT_INDEXED(format)
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat GLfloat h
static int readRlePixels(SDL_Surface *surface, SDL_RWops *src, int isRle8)
SDL_Surface * SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format, Uint32 flags)
#define SDL_stack_alloc(type, count)
#define SDL_COPY_RLE_DESIRED
@ SDL_YUV_CONVERSION_JPEG
GLfloat GLfloat GLfloat alpha
int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
Set the blend mode used for blit operations.
#define SDL_GetHintBoolean
int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
static void SDL_FillRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillRect2(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
SDL_Surface * SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
GLint GLint GLsizei GLsizei height
int SDL_RLESurface(SDL_Surface *surface)
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF mov
SDL_YUV_CONVERSION_MODE
The formula used for converting between YUV and RGB.
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
Sets the color key (transparent pixel) in a blittable surface.
#define LCS_WINDOWS_COLOR_SPACE
#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT
Prevent SDL from using version 4 of the bitmap header when saving BMPs.
#define SDL_assert(condition)
GLint GLint GLsizei GLsizei GLsizei depth
void SDL_UnlockSurface(SDL_Surface *surface)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
#define SDL_COPY_MODULATE_ALPHA
SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect)
static void CorrectAlphaChannel(SDL_Surface *surface)
SDL_Surface * SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
#define SDL_OutOfMemory()
static void SDL_FillRect3(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
#define SDL_COPY_RLE_ALPHAKEY
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
#define SDL_CreateRGBSurface
int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
Set the palette used by a surface.
int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static int SDL_CalculatePitch(Uint32 format, int width)
int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
Sets the RLE acceleration hint for a surface.
#define SDL_stack_free(data)
#define SDL_ISPIXELFORMAT_FOURCC(format)
#define SDL_BYTESPERPIXEL(X)
void SDL_InvalidateMap(SDL_BlitMap *map)
A rectangle, with the origin at the upper left (integer).
#define SDL_MAX_SINT32
A signed 32-bit integer type.
@ SDL_PIXELFORMAT_UNKNOWN
void SDL_FreeSurface(SDL_Surface *surface)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
#define SDL_COPY_MODULATE_COLOR
int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
#define SDL_ALPHA_TRANSPARENT
static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode
#define SDL_Unsupported()
@ SDL_YUV_CONVERSION_BT709
void SDL_FreeBlitMap(SDL_BlitMap *map)
static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, SDL_bool ignore_alpha)
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
#define SDL_SetPixelFormatPalette
EGLSurface EGLint * rects
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
@ SDL_YUV_CONVERSION_BT601
int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
@ SDL_YUV_CONVERSION_AUTOMATIC
GLubyte GLubyte GLubyte GLubyte w
int SDL_InitFormat(SDL_PixelFormat *format, Uint32 pixel_format)