Added SDL_FlipSurface() to flip a surface vertically or horizontally

Fixes https://github.com/libsdl-org/SDL/issues/8857
This commit is contained in:
Sam Lantinga 2024-01-20 06:31:37 -08:00
parent 2cd583ee13
commit 308906ba25
13 changed files with 184 additions and 21 deletions

View file

@ -105,16 +105,6 @@ typedef enum
SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
} SDL_TextureAccess;
/**
* Flip constants for SDL_RenderTextureRotated
*/
typedef enum
{
SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
} SDL_RendererFlip;
/**
* How the logical size is mapped to the output
*/
@ -1494,7 +1484,7 @@ extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Textur
* \param center A pointer to a point indicating the point around which
* dstrect will be rotated (if NULL, rotation will be done
* around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should
* \param flip An SDL_FlipMode value stating which flipping actions should
* be performed on the texture
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
@ -1504,7 +1494,7 @@ extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Textur
extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
const SDL_FRect *srcrect, const SDL_FRect *dstrect,
const double angle, const SDL_FPoint *center,
const SDL_RendererFlip flip);
const SDL_FlipMode flip);
/**
* Render a list of triangles, optionally using a texture and indices into the

View file

@ -75,6 +75,15 @@ typedef enum
SDL_SCALEMODE_BEST /**< anisotropic filtering */
} SDL_ScaleMode;
/**
* The flip mode
*/
typedef enum
{
SDL_FLIP_NONE, /**< Do not flip */
SDL_FLIP_HORIZONTAL, /**< flip horizontally */
SDL_FLIP_VERTICAL /**< flip vertically */
} SDL_FlipMode;
/**
* A collection of pixels used in software blitting.
@ -602,6 +611,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface,
extern DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
SDL_Rect *rect);
/*
* Flip a surface vertically or horizontally.
*
* \param surface the surface to flip
* \param flip the direction to flip
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
/*
* Creates a new surface identical to the existing surface.
*