zenilib
0.5.3.0
|
#include "SDL_config.h"
#include "SDL_video.h"
#include "SDL_sysvideo.h"
#include "SDL_blit.h"
#include "SDL_RLEaccel_c.h"
#include "SDL_pixels_c.h"
Go to the source code of this file.
|
static |
Definition at line 236 of file SDL_surface.c.
References SDL_PixelFormat::Amask, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, SDL_BlitInfo::flags, for(), SDL_Surface::format, SDL_Surface::h, SDL_BlitMap::info, SDL_Surface::map, SDL_Surface::pitch, SDL_Surface::pixels, SDL_BLENDMODE_BLEND, SDL_COPY_COLORKEY, SDL_LockSurface(), SDL_SetColorKey(), SDL_SetSurfaceBlendMode(), SDL_UnlockSurface(), and SDL_Surface::w.
Referenced by SDL_ConvertSurface().
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 984 of file SDL_surface.c.
References SDL_Rect::h, SDL_BYTESPERPIXEL, SDL_CreateSurfaceOnStack(), SDL_InvalidParamError, SDL_ISPIXELFORMAT_FOURCC, SDL_LowerBlit(), SDL_memcpy(), SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, SDL_SetError(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_UnlockTextureNative(), SDL_UpdateTextureNative(), and SW_RenderReadPixels().
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 804 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_CreateTextureFromSurface(), and SDL_SaveBMP_RW().
SDL_Surface* SDL_ConvertSurfaceFormat | ( | SDL_Surface * | surface, |
Uint32 | pixel_format, | ||
Uint32 | flags | ||
) |
Definition at line 928 of file SDL_surface.c.
References NULL, SDL_AllocFormat(), SDL_ConvertSurface(), and SDL_FreeFormat().
Referenced by SDL_CreateColorCursor(), and SDL_SetWindowIcon().
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 35 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(), and SDL_Surface::w.
Referenced by _rotateSurface(), SDL_ConvertSurface(), SDL_CreateCursor(), SDL_CreateRGBSurfaceFrom(), SDL_LoadBMP_RW(), SDL_SW_CopyYUVToRGB(), SDLTest_DrawCharacter(), SDLTest_ScreenShot(), SW_CreateTexture(), and SW_RenderCopyEx().
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 122 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.
Referenced by Zeni::Window::alert_window_resized(), SDL_CreateWindowFramebuffer(), SDL_SW_CopyYUVToRGB(), SDLTest_ImageBlit(), SDLTest_ImageBlitAlpha(), SDLTest_ImageBlitBlend(), SDLTest_ImageBlitBlendAdd(), SDLTest_ImageBlitBlendAll(), SDLTest_ImageBlitBlendMod(), SDLTest_ImageBlitBlendNone(), SDLTest_ImageBlitColor(), SDLTest_ImageFace(), SDLTest_ImagePrimitives(), and SDLTest_ImagePrimitivesBlend().
|
static |
Definition at line 946 of file SDL_surface.c.
References SDL_BlitInfo::a, SDL_BlitInfo::b, SDL_Surface::flags, SDL_Surface::format, SDL_BlitInfo::g, SDL_Surface::h, SDL_BlitMap::info, SDL_Surface::map, SDL_Surface::pitch, SDL_Surface::pixels, SDL_BlitInfo::r, SDL_Surface::refcount, SDL_FALSE, SDL_InitFormat(), SDL_ISPIXELFORMAT_INDEXED, SDL_PREALLOC, SDL_SetError(), SDL_TRUE, SDL_zerop, and SDL_Surface::w.
Referenced by SDL_ConvertPixels().
void SDL_FreeSurface | ( | SDL_Surface * | surface | ) |
Definition at line 1053 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 _rotateSurface(), Zeni::Window::alert_window_resized(), cleanup(), SDL_CreateColorCursor(), SDL_CreateCursor(), SDL_CreateRGBSurface(), SDL_CreateTextureFromSurface(), SDL_DestroyWindow(), SDL_GetWindowSurface(), SDL_InvalidateMap(), SDL_LoadBMP_RW(), SDL_RecreateWindow(), SDL_SaveBMP_RW(), SDL_SetWindowIcon(), SDL_SW_DestroyYUVTexture(), SDL_SW_SetupYUVDisplay(), SDLTest_CommonInit(), SDLTest_DrawCharacter(), SW_DestroyTexture(), SW_RenderCopyEx(), and Zeni::Window::~Window().
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 477 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 218 of file SDL_surface.c.
References SDL_BlitInfo::colorkey, SDL_BlitInfo::flags, SDL_BlitMap::info, SDL_Surface::map, and SDL_COPY_COLORKEY.
Referenced by _colorkey(), SDL_CreateTextureFromSurface(), and SW_RenderCopyEx().
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 374 of file SDL_surface.c.
References SDL_BlitInfo::a, SDL_BlitMap::info, and SDL_Surface::map.
Referenced by SDL_CreateTextureFromSurface().
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 424 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.
Referenced by SDL_CreateTextureFromSurface().
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 332 of file SDL_surface.c.
References SDL_BlitInfo::b, SDL_BlitInfo::g, SDL_BlitMap::info, SDL_Surface::map, and SDL_BlitInfo::r.
Referenced by SDL_CreateTextureFromSurface().
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 765 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::locked, SDL_RLEACCEL, and SDL_UnRLESurface().
Referenced by _rotateSurface(), SDL_CalculateShapeBitmap(), SDL_CalculateShapeTree(), SDL_ConvertColorkeyToAlpha(), SDL_CreateTextureFromSurface(), SDL_RLEAlphaBlit(), SDL_RLEBlit(), SDL_SaveBMP_RW(), SDL_SoftBlit(), SDL_SoftStretch(), SDLTest_CompareSurfaces(), and SW_UpdateTexture().
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 496 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 704 of file SDL_surface.c.
References SDL_Surface::clip_rect, SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::format, SDL_Rect::h, SDL_Surface::h, 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_IntersectRect(), SDL_ISPIXELFORMAT_INDEXED, SDL_LowerBlit(), SDL_SoftStretch(), SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by SDL_UpperBlitScaled().
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 453 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(), SDL_CreateRGBSurfaceFrom(), SW_RenderClear(), SW_UpdateClipRect(), and SW_UpdateViewport().
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 173 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 _rotateSurface(), SDL_ConvertColorkeyToAlpha(), SDL_ConvertSurface(), SDLTest_LoadIcon(), and SW_RenderCopyEx().
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 351 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().
Referenced by SW_CreateTexture(), and SW_SetTextureAlphaMod().
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 387 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(), SDL_CreateRGBSurface(), SW_CreateTexture(), and SW_SetTextureBlendMode().
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 306 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().
Referenced by SW_CreateTexture(), and SW_SetTextureColorMod().
int SDL_SetSurfacePalette | ( | SDL_Surface * | surface, |
SDL_Palette * | palette | ||
) |
Set the palette used by a surface.
Definition at line 143 of file SDL_surface.c.
References SDL_Surface::format, 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 152 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(), SDL_SetColorKey(), and SW_CreateTexture().
void SDL_UnlockSurface | ( | SDL_Surface * | surface | ) |
Definition at line 786 of file SDL_surface.c.
References SDL_Surface::flags, SDL_Surface::locked, SDL_RLEACCEL, and SDL_RLESurface().
Referenced by _rotateSurface(), SDL_CalculateShapeBitmap(), SDL_CalculateShapeTree(), SDL_ConvertColorkeyToAlpha(), SDL_CreateTextureFromSurface(), SDL_FreeSurface(), SDL_RLEAlphaBlit(), SDL_RLEBlit(), SDL_SaveBMP_RW(), SDL_SoftBlit(), SDL_SoftStretch(), SDLTest_CompareSurfaces(), and SW_UpdateTexture().
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 519 of file SDL_surface.c.
References SDL_Surface::clip_rect, SDL_Rect::h, SDL_Surface::h, SDL_Surface::locked, NULL, 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 612 of file SDL_surface.c.
References SDL_Rect::h, SDL_Surface::h, SDL_Surface::locked, NULL, SDL_LowerBlitScaled(), SDL_SetError(), SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.