zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_surface.h File Reference
#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.

Classes

struct  SDL_Surface
 A collection of pixels used in software blitting. More...
 

Macros

#define SDL_BlitScaled   SDL_UpperBlitScaled
 
#define SDL_BlitSurface   SDL_UpperBlit
 
#define SDL_LoadBMP(file)   SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
 
#define SDL_MUSTLOCK(S)   (((S)->flags & SDL_RLEACCEL) != 0)
 
#define SDL_SaveBMP(surface, file)   SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
 
Surface flags

These are the currently supported flags for the SDL_Surface.

#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...
 
typedef struct SDL_Surface SDL_Surface
 A collection of pixels used in software blitting. More...
 

Functions

DECLSPEC int SDLCALL 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...
 
DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface (SDL_Surface *src, const SDL_PixelFormat *fmt, Uint32 flags)
 
DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat (SDL_Surface *src, Uint32 pixel_format, Uint32 flags)
 
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 
DECLSPEC int SDLCALL SDL_FillRect (SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
 
DECLSPEC int SDLCALL SDL_FillRects (SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color)
 
DECLSPEC void SDLCALL SDL_FreeSurface (SDL_Surface *surface)
 
DECLSPEC void SDLCALL SDL_GetClipRect (SDL_Surface *surface, SDL_Rect *rect)
 
DECLSPEC int SDLCALL SDL_GetColorKey (SDL_Surface *surface, Uint32 *key)
 Gets the color key (transparent pixel) in a blittable surface. More...
 
DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod (SDL_Surface *surface, Uint8 *alpha)
 Get the additional alpha value used in blit operations. More...
 
DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode *blendMode)
 Get the blend mode used for blit operations. More...
 
DECLSPEC int SDLCALL SDL_GetSurfaceColorMod (SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
 Get the additional color value used in blit operations. More...
 
DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW (SDL_RWops *src, int freesrc)
 
DECLSPEC int SDLCALL SDL_LockSurface (SDL_Surface *surface)
 Sets up a surface for directly accessing the pixels. More...
 
DECLSPEC int SDLCALL SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 
DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 
DECLSPEC int SDLCALL SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, int freedst)
 
DECLSPEC SDL_bool SDLCALL SDL_SetClipRect (SDL_Surface *surface, const SDL_Rect *rect)
 
DECLSPEC int SDLCALL SDL_SetColorKey (SDL_Surface *surface, int flag, Uint32 key)
 Sets the color key (transparent pixel) in a blittable surface. More...
 
DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod (SDL_Surface *surface, Uint8 alpha)
 Set an additional alpha value used in blit operations. More...
 
DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode blendMode)
 Set the blend mode used for blit operations. More...
 
DECLSPEC int SDLCALL SDL_SetSurfaceColorMod (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
 Set an additional color value used in blit operations. More...
 
DECLSPEC int SDLCALL SDL_SetSurfacePalette (SDL_Surface *surface, SDL_Palette *palette)
 Set the palette used by a surface. More...
 
DECLSPEC int SDLCALL SDL_SetSurfaceRLE (SDL_Surface *surface, int flag)
 Sets the RLE acceleration hint for a surface. More...
 
DECLSPEC int SDLCALL 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...
 
DECLSPEC void SDLCALL SDL_UnlockSurface (SDL_Surface *surface)
 
DECLSPEC int SDLCALL SDL_UpperBlit (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 
DECLSPEC int SDLCALL SDL_UpperBlitScaled (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 

Detailed Description

Header file for SDL_Surface definition and management functions.

Definition in file SDL_surface.h.

Macro Definition Documentation

#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.

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 447 of file SDL_surface.h.

Referenced by _rotateSurface(), 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 main(), and SDLTest_LoadIcon().

#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 _rotateSurface(), SDL_CalculateShapeBitmap(), SDL_CalculateShapeTree(), SDL_CreateTextureFromSurface(), SDL_RLEAlphaBlit(), SDL_RLEBlit(), SDL_SoftBlit(), SDL_SoftStretch(), 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
#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(), and SDLTest_ScreenShot().

#define SDL_SWSURFACE   0

Just here for compatibility

Definition at line 52 of file SDL_surface.h.

Referenced by _rotateSurface(), main(), SDLTest_DrawCharacter(), and SW_RenderCopyEx().

Typedef Documentation

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.

typedef struct SDL_Surface SDL_Surface

A collection of pixels used in software blitting.

Note
This structure should be treated as read-only, except for pixels, which, if not NULL, contains the raw pixel data for the surface.

Function Documentation

DECLSPEC int SDLCALL SDL_ConvertPixels ( int  width,
int  height,
Uint32  src_format,
const void src,
int  src_pitch,
Uint32  dst_format,
void dst,
int  dst_pitch 
)
DECLSPEC SDL_Surface* SDLCALL 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().

DECLSPEC SDL_Surface* SDLCALL SDL_ConvertSurfaceFormat ( SDL_Surface src,
Uint32  pixel_format,
Uint32  flags 
)
DECLSPEC SDL_Surface* SDLCALL 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.

Parameters
flagsThe flags are obsolete and should be set to 0.
widthThe width in pixels of the surface to create.
heightThe height in pixels of the surface to create.
depthThe depth in bits of the surface to create.
RmaskThe red mask of the surface to create.
GmaskThe green mask of the surface to create.
BmaskThe blue mask of the surface to create.
AmaskThe 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().

DECLSPEC int SDLCALL 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.

Returns
0 on success, or -1 on error.

Definition at line 332 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_HasMMX(), SDL_HasSSE(), SDL_IntersectRect(), SDL_SetError(), switch(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by _rotateSurface(), SDL_FillRects(), SDL_UnRLESurface(), and SW_RenderClear().

DECLSPEC int SDLCALL SDL_FillRects ( SDL_Surface dst,
const SDL_Rect rects,
int  count,
Uint32  color 
)

Definition at line 436 of file SDL_fillrect.c.

References i, SDL_FillRect(), and SDL_SetError().

Referenced by SW_RenderFillRects().

DECLSPEC void SDLCALL 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.

DECLSPEC int SDLCALL SDL_GetColorKey ( SDL_Surface surface,
Uint32 key 
)

Gets the color key (transparent pixel) in a blittable surface.

Parameters
surfaceThe surface to update
keyA 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 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().

DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod ( SDL_Surface surface,
Uint8 alpha 
)

Get the additional alpha value used in blit operations.

Parameters
surfaceThe surface to query.
alphaA 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 374 of file SDL_surface.c.

References SDL_BlitInfo::a, SDL_BlitMap::info, and SDL_Surface::map.

Referenced by SDL_CreateTextureFromSurface().

DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode ( SDL_Surface surface,
SDL_BlendMode blendMode 
)

Get the blend mode used for blit operations.

Parameters
surfaceThe surface to query.
blendModeA 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 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().

DECLSPEC int SDLCALL SDL_GetSurfaceColorMod ( SDL_Surface surface,
Uint8 r,
Uint8 g,
Uint8 b 
)

Get the additional color value used in blit operations.

Parameters
surfaceThe surface to query.
rA pointer filled in with the current red color value.
gA pointer filled in with the current green color value.
bA 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 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().

DECLSPEC SDL_Surface* SDLCALL SDL_LoadBMP_RW ( SDL_RWops src,
int  freesrc 
)
DECLSPEC int SDLCALL 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.

See Also
SDL_UnlockSurface()

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().

DECLSPEC int SDLCALL SDL_LowerBlit ( SDL_Surface src,
SDL_Rect srcrect,
SDL_Surface dst,
SDL_Rect dstrect 
)
DECLSPEC SDL_bool SDLCALL 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().

DECLSPEC int SDLCALL SDL_SetColorKey ( SDL_Surface surface,
int  flag,
Uint32  key 
)

Sets the color key (transparent pixel) in a blittable surface.

Parameters
surfaceThe surface to update
flagNon-zero to enable colorkey and 0 to disable colorkey
keyThe transparent pixel in the native surface format
Returns
0 on success, or -1 if the surface is not valid

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().

DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod ( SDL_Surface surface,
Uint8  alpha 
)

Set an additional alpha value used in blit operations.

Parameters
surfaceThe surface to update.
alphaThe alpha value multiplied into blit operations.
Returns
0 on success, or -1 if the surface is not valid.
See Also
SDL_GetSurfaceAlphaMod()

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().

DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode ( SDL_Surface surface,
SDL_BlendMode  blendMode 
)

Set the blend mode used for blit operations.

Parameters
surfaceThe surface to update.
blendModeSDL_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 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().

DECLSPEC int SDLCALL SDL_SetSurfaceColorMod ( SDL_Surface surface,
Uint8  r,
Uint8  g,
Uint8  b 
)

Set an additional color value used in blit operations.

Parameters
surfaceThe surface to update.
rThe red color value multiplied into blit operations.
gThe green color value multiplied into blit operations.
bThe 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 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().

DECLSPEC int SDLCALL SDL_SetSurfacePalette ( SDL_Surface surface,
SDL_Palette palette 
)

Set the palette used by a surface.

Returns
0, or -1 if the surface format doesn't use a palette.
Note
A single palette can be shared with many surfaces.

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().

DECLSPEC int SDLCALL SDL_SetSurfaceRLE ( SDL_Surface surface,
int  flag 
)

Sets the RLE acceleration hint for a surface.

Returns
0 on success, or -1 if the surface is not valid
Note
If RLE is enabled, colorkey and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.

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().

DECLSPEC int SDLCALL 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.

Note
This function uses a static buffer, and is not thread-safe.

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, if(), 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.

Referenced by SDL_LowerBlitScaled(), and SDL_SW_CopyYUVToRGB().

DECLSPEC int SDLCALL 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.

DECLSPEC int SDLCALL 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.