World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл SDL_surface.h

См. исходные тексты.

Классы

struct  SDL_Surface
 A collection of pixels used in software blitting. Подробнее...
 

Surface flags

These are the currently supported flags for the SDL_Surface.

Used internally (read-only).

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. Подробнее...
 
typedef struct SDL_Surface SDL_Surface
 A collection of pixels used in software blitting. Подробнее...
 
typedef int(SDLCALL * 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. Подробнее...
 
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_CreateRGBSurfaceWithFormat (Uint32 flags, int width, int height, int depth, Uint32 format)
 
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 SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 format)
 
DECLSPEC void SDLCALL SDL_FreeSurface (SDL_Surface *surface)
 
DECLSPEC int SDLCALL SDL_SetSurfacePalette (SDL_Surface *surface, SDL_Palette *palette)
 Set the palette used by a surface. Подробнее...
 
DECLSPEC int SDLCALL SDL_LockSurface (SDL_Surface *surface)
 Sets up a surface for directly accessing the pixels. Подробнее...
 
DECLSPEC void SDLCALL SDL_UnlockSurface (SDL_Surface *surface)
 
DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW (SDL_RWops *src, int freesrc)
 
DECLSPEC int SDLCALL SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, int freedst)
 
DECLSPEC int SDLCALL SDL_SetSurfaceRLE (SDL_Surface *surface, int flag)
 Sets the RLE acceleration hint for a surface. Подробнее...
 
DECLSPEC int SDLCALL SDL_SetColorKey (SDL_Surface *surface, int flag, Uint32 key)
 Sets the color key (transparent pixel) in a blittable surface. Подробнее...
 
DECLSPEC SDL_bool SDLCALL SDL_HasColorKey (SDL_Surface *surface)
 Returns whether the surface has a color key. Подробнее...
 
DECLSPEC int SDLCALL SDL_GetColorKey (SDL_Surface *surface, Uint32 *key)
 Gets the color key (transparent pixel) in a blittable surface. Подробнее...
 
DECLSPEC int SDLCALL SDL_SetSurfaceColorMod (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
 Set an additional color value used in blit operations. Подробнее...
 
DECLSPEC int SDLCALL SDL_GetSurfaceColorMod (SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
 Get the additional color value used in blit operations. Подробнее...
 
DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod (SDL_Surface *surface, Uint8 alpha)
 Set an additional alpha value used in blit operations. Подробнее...
 
DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod (SDL_Surface *surface, Uint8 *alpha)
 Get the additional alpha value used in blit operations. Подробнее...
 
DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode blendMode)
 Set the blend mode used for blit operations. Подробнее...
 
DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode *blendMode)
 Get the blend mode used for blit operations. Подробнее...
 
DECLSPEC SDL_bool SDLCALL SDL_SetClipRect (SDL_Surface *surface, const SDL_Rect *rect)
 
DECLSPEC void SDLCALL SDL_GetClipRect (SDL_Surface *surface, SDL_Rect *rect)
 
DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface (SDL_Surface *surface)
 
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 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. Подробнее...
 
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 int SDLCALL SDL_UpperBlit (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 
DECLSPEC int SDLCALL SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 
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. Подробнее...
 
DECLSPEC int SDLCALL SDL_UpperBlitScaled (SDL_Surface *src, const 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 void SDLCALL SDL_SetYUVConversionMode (SDL_YUV_CONVERSION_MODE mode)
 Set the YUV conversion mode. Подробнее...
 
DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode (void)
 Get the YUV conversion mode. Подробнее...
 
DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL 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. Подробнее...
 

Подробное описание

Header file for SDL_Surface definition and management functions.

См. определение в файле SDL_surface.h

Типы

◆ SDL_Surface

typedef struct SDL_Surface SDL_Surface

A collection of pixels used in software blitting.

Заметки
This structure should be treated as read-only, except for pixels, which, if not NULL, contains the raw pixel data for the surface.

◆ SDL_blit

typedef int(SDLCALL * 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.

См. определение в файле SDL_surface.h строка 98

Перечисления

◆ SDL_YUV_CONVERSION_MODE

The formula used for converting between YUV and RGB.

Элементы перечислений
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

См. определение в файле SDL_surface.h строка 104

Функции

◆ SDL_CreateRGBSurface()

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.

Аргументы
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.

◆ SDL_CreateRGBSurfaceWithFormat()

DECLSPEC SDL_Surface* SDLCALL SDL_CreateRGBSurfaceWithFormat ( Uint32  flags,
int  width,
int  height,
int  depth,
Uint32  format 
)

◆ SDL_CreateRGBSurfaceFrom()

DECLSPEC SDL_Surface* SDLCALL SDL_CreateRGBSurfaceFrom ( void pixels,
int  width,
int  height,
int  depth,
int  pitch,
Uint32  Rmask,
Uint32  Gmask,
Uint32  Bmask,
Uint32  Amask 
)

◆ SDL_CreateRGBSurfaceWithFormatFrom()

DECLSPEC SDL_Surface* SDLCALL SDL_CreateRGBSurfaceWithFormatFrom ( void pixels,
int  width,
int  height,
int  depth,
int  pitch,
Uint32  format 
)

◆ SDL_FreeSurface()

DECLSPEC void SDLCALL SDL_FreeSurface ( SDL_Surface surface)

◆ SDL_SetSurfacePalette()

DECLSPEC int SDLCALL SDL_SetSurfacePalette ( SDL_Surface surface,
SDL_Palette palette 
)

Set the palette used by a surface.

Возвращает
0, or -1 if the surface format doesn't use a palette.
Заметки
A single palette can be shared with many surfaces.

◆ SDL_LockSurface()

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.

См. также
SDL_UnlockSurface()

◆ SDL_UnlockSurface()

DECLSPEC void SDLCALL SDL_UnlockSurface ( SDL_Surface surface)
См. также
SDL_LockSurface()

◆ SDL_LoadBMP_RW()

DECLSPEC SDL_Surface* SDLCALL 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().

Возвращает
the new surface, or NULL if there was an error.

◆ SDL_SaveBMP_RW()

DECLSPEC int SDLCALL SDL_SaveBMP_RW ( SDL_Surface surface,
SDL_RWops dst,
int  freedst 
)

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.

Возвращает
0 if successful or -1 if there was an error.

◆ SDL_SetSurfaceRLE()

DECLSPEC int SDLCALL SDL_SetSurfaceRLE ( SDL_Surface surface,
int  flag 
)

Sets the RLE acceleration hint for a surface.

Возвращает
0 on success, or -1 if the surface is not valid
Заметки
If RLE is enabled, colorkey and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.

◆ SDL_SetColorKey()

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

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

Аргументы
surfaceThe surface to update
flagNon-zero to enable colorkey and 0 to disable colorkey
keyThe transparent pixel in the native surface format
Возвращает
0 on success, or -1 if the surface is not valid

You can pass SDL_RLEACCEL to enable RLE accelerated blits.

◆ SDL_HasColorKey()

DECLSPEC SDL_bool SDLCALL SDL_HasColorKey ( SDL_Surface surface)

Returns whether the surface has a color key.

Возвращает
SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key

◆ SDL_GetColorKey()

DECLSPEC int SDLCALL SDL_GetColorKey ( SDL_Surface surface,
Uint32 key 
)

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

Аргументы
surfaceThe surface to update
keyA pointer filled in with the transparent pixel in the native surface format
Возвращает
0 on success, or -1 if the surface is not valid or colorkey is not enabled.

◆ SDL_SetSurfaceColorMod()

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

Set an additional color value used in blit operations.

Аргументы
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.
Возвращает
0 on success, or -1 if the surface is not valid.
См. также
SDL_GetSurfaceColorMod()

◆ SDL_GetSurfaceColorMod()

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

Get the additional color value used in blit operations.

Аргументы
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.
Возвращает
0 on success, or -1 if the surface is not valid.
См. также
SDL_SetSurfaceColorMod()

◆ SDL_SetSurfaceAlphaMod()

DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod ( SDL_Surface surface,
Uint8  alpha 
)

Set an additional alpha value used in blit operations.

Аргументы
surfaceThe surface to update.
alphaThe alpha value multiplied into blit operations.
Возвращает
0 on success, or -1 if the surface is not valid.
См. также
SDL_GetSurfaceAlphaMod()

◆ SDL_GetSurfaceAlphaMod()

DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod ( SDL_Surface surface,
Uint8 alpha 
)

Get the additional alpha value used in blit operations.

Аргументы
surfaceThe surface to query.
alphaA pointer filled in with the current alpha value.
Возвращает
0 on success, or -1 if the surface is not valid.
См. также
SDL_SetSurfaceAlphaMod()

◆ SDL_SetSurfaceBlendMode()

DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode ( SDL_Surface surface,
SDL_BlendMode  blendMode 
)

Set the blend mode used for blit operations.

Аргументы
surfaceThe surface to update.
blendModeSDL_BlendMode to use for blit blending.
Возвращает
0 on success, or -1 if the parameters are not valid.
См. также
SDL_GetSurfaceBlendMode()

◆ SDL_GetSurfaceBlendMode()

DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode ( SDL_Surface surface,
SDL_BlendMode blendMode 
)

Get the blend mode used for blit operations.

Аргументы
surfaceThe surface to query.
blendModeA pointer filled in with the current blend mode.
Возвращает
0 on success, or -1 if the surface is not valid.
См. также
SDL_SetSurfaceBlendMode()

◆ SDL_SetClipRect()

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.

◆ SDL_GetClipRect()

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.

◆ SDL_DuplicateSurface()

DECLSPEC SDL_Surface* SDLCALL SDL_DuplicateSurface ( SDL_Surface surface)

◆ SDL_ConvertSurface()

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.

◆ SDL_ConvertSurfaceFormat()

DECLSPEC SDL_Surface* SDLCALL SDL_ConvertSurfaceFormat ( SDL_Surface src,
Uint32  pixel_format,
Uint32  flags 
)

◆ SDL_ConvertPixels()

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.

Возвращает
0 on success, or -1 if there was an error

◆ SDL_FillRect()

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.

Возвращает
0 on success, or -1 on error.

◆ SDL_FillRects()

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

◆ SDL_UpperBlit()

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

◆ SDL_LowerBlit()

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

◆ SDL_SoftStretch()

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.

Заметки
This function uses a static buffer, and is not thread-safe.

◆ SDL_UpperBlitScaled()

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

◆ SDL_LowerBlitScaled()

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

◆ SDL_SetYUVConversionMode()

DECLSPEC void SDLCALL SDL_SetYUVConversionMode ( SDL_YUV_CONVERSION_MODE  mode)

Set the YUV conversion mode.

◆ SDL_GetYUVConversionMode()

DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode ( void  )

Get the YUV conversion mode.

◆ SDL_GetYUVConversionModeForResolution()

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

SDL_YUV_CONVERSION_JPEG
@ SDL_YUV_CONVERSION_JPEG
Definition: SDL_surface.h:106
SDL_YUV_CONVERSION_MODE
SDL_YUV_CONVERSION_MODE
The formula used for converting between YUV and RGB.
Definition: SDL_surface.h:104
SDL_YUV_CONVERSION_BT709
@ SDL_YUV_CONVERSION_BT709
Definition: SDL_surface.h:108
SDL_YUV_CONVERSION_BT601
@ SDL_YUV_CONVERSION_BT601
Definition: SDL_surface.h:107
SDL_YUV_CONVERSION_AUTOMATIC
@ SDL_YUV_CONVERSION_AUTOMATIC
Definition: SDL_surface.h:109