Use the enumerated type for blend and scale mode instead of int
Renamed SDL_TextureScaleMode to SDL_ScaleMode
This commit is contained in:
parent
0893ec9ce4
commit
35cc558917
28 changed files with 355 additions and 282 deletions
64
include/SDL_blendmode.h
Normal file
64
include/SDL_blendmode.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_blendmode.h
|
||||
*
|
||||
* Header file declaring the SDL_BlendMode enumeration
|
||||
*/
|
||||
|
||||
#ifndef _SDL_blendmode_h
|
||||
#define _SDL_blendmode_h
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
|
||||
SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst
|
||||
(alpha is mask) */
|
||||
|
||||
SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
|
||||
SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
|
||||
} SDL_BlendMode;
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -202,6 +202,14 @@ typedef enum
|
|||
SDL_GRAB_ON = 1
|
||||
} SDL_GrabMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_TEXTURESCALEMODE_NONE = SDL_SCALEMODE_NONE,
|
||||
SDL_TEXTURESCALEMODE_FAST = SDL_SCALEMODE_FAST,
|
||||
SDL_TEXTURESCALEMODE_SLOW = SDL_SCALEMODE_SLOW,
|
||||
SDL_TEXTURESCALEMODE_BEST = SDL_SCALEMODE_BEST
|
||||
} SDL_TextureScaleMode;
|
||||
|
||||
struct SDL_SysWMinfo;
|
||||
|
||||
/**
|
||||
|
|
69
include/SDL_scalemode.h
Normal file
69
include/SDL_scalemode.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_scalemode.h
|
||||
*
|
||||
* Header file declaring the SDL_ScaleMode enumeration
|
||||
*/
|
||||
|
||||
#ifndef _SDL_scalemode_h
|
||||
#define _SDL_scalemode_h
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The texture scale mode used in SDL_RenderCopy().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_SCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must
|
||||
match dimensions */
|
||||
|
||||
SDL_SCALEMODE_FAST = 0x00000001, /**< Point sampling or
|
||||
equivalent algorithm */
|
||||
|
||||
SDL_SCALEMODE_SLOW = 0x00000002, /**< Linear filtering or
|
||||
equivalent algorithm */
|
||||
|
||||
SDL_SCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or
|
||||
equivalent algorithm */
|
||||
} SDL_ScaleMode;
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -32,6 +32,8 @@
|
|||
#include "SDL_stdinc.h"
|
||||
#include "SDL_pixels.h"
|
||||
#include "SDL_rect.h"
|
||||
#include "SDL_blendmode.h"
|
||||
#include "SDL_scalemode.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
|
@ -88,7 +90,7 @@ typedef struct SDL_Surface
|
|||
struct SDL_BlitMap *map; /**< Private */
|
||||
|
||||
/** format version, bumped at every change to invalidate blit maps */
|
||||
unsigned int format_version; /**< Private */
|
||||
int format_version; /**< Private */
|
||||
|
||||
/** Reference count -- used when freeing surface */
|
||||
int refcount; /**< Read-mostly */
|
||||
|
@ -300,7 +302,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
|
|||
* \sa SDL_GetSurfaceBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
||||
int blendMode);
|
||||
SDL_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* \brief Get the blend mode used for blit operations.
|
||||
|
@ -313,13 +315,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
|||
* \sa SDL_SetSurfaceBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
||||
int *blendMode);
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Set the scale mode used for blit operations.
|
||||
*
|
||||
* \param surface The surface to update.
|
||||
* \param scaleMode ::SDL_TextureScaleMode to use for blit scaling.
|
||||
* \param scaleMode ::SDL_ScaleMode to use for blit scaling.
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid or the scale mode is
|
||||
* not supported.
|
||||
|
@ -331,7 +333,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
|||
* \sa SDL_GetSurfaceScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
|
||||
int scaleMode);
|
||||
SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Get the scale mode used for blit operations.
|
||||
|
@ -344,7 +346,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
|
|||
* \sa SDL_SetSurfaceScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
|
||||
int *scaleMode);
|
||||
SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* Sets the clipping rectangle for the destination surface in a blit.
|
||||
|
@ -413,10 +415,10 @@ extern DECLSPEC int SDLCALL SDL_DrawPoints
|
|||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendPoint
|
||||
(SDL_Surface * dst, int x, int y,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendPoints
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Draws a line with \c color.
|
||||
|
@ -438,10 +440,10 @@ extern DECLSPEC int SDLCALL SDL_DrawLines
|
|||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendLine
|
||||
(SDL_Surface * dst, int x1, int y1, int x2, int y2,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendLines
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Draws the given rectangle with \c color.
|
||||
|
@ -467,10 +469,10 @@ extern DECLSPEC int SDLCALL SDL_DrawRects
|
|||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Performs a fast fill of the given rectangle with \c color.
|
||||
|
@ -496,92 +498,10 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Draws the given circle with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DrawCircle
|
||||
(SDL_Surface * dst, int x, int y, int radius, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the outline of the given circle.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendCircle
|
||||
(SDL_Surface * dst, int x, int y, int radius,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Fills the given circle with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_FillCircle
|
||||
(SDL_Surface * dst, int x, int y, int radius, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the given circle.
|
||||
*
|
||||
* \return This function returns 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillCircle
|
||||
(SDL_Surface * dst, int x, int y, int radius,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Draws the given ellipse with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DrawEllipse
|
||||
(SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the outline of the given ellipse.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendEllipse
|
||||
(SDL_Surface * dst, int x, int y, int w, int h,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Fills the given ellipse with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_FillEllipse
|
||||
(SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the given ellipse.
|
||||
*
|
||||
* \return This function returns 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillEllipse
|
||||
(SDL_Surface * dst, int x, int y, int w, int h,
|
||||
int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
#endif // 0
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Performs a fast blit from the source surface to the destination surface.
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "SDL_stdinc.h"
|
||||
#include "SDL_pixels.h"
|
||||
#include "SDL_rect.h"
|
||||
#include "SDL_blendmode.h"
|
||||
#include "SDL_scalemode.h"
|
||||
#include "SDL_surface.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
|
@ -213,38 +215,6 @@ typedef enum
|
|||
SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
|
||||
} SDL_TextureModulate;
|
||||
|
||||
/**
|
||||
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
|
||||
SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst
|
||||
(alpha is mask) */
|
||||
|
||||
SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
|
||||
SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
|
||||
} SDL_BlendMode;
|
||||
|
||||
/**
|
||||
* \brief The texture scale mode used in SDL_RenderCopy().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_TEXTURESCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must
|
||||
match dimensions */
|
||||
|
||||
SDL_TEXTURESCALEMODE_FAST = 0x00000001, /**< Point sampling or
|
||||
equivalent algorithm */
|
||||
|
||||
SDL_TEXTURESCALEMODE_SLOW = 0x00000002, /**< Linear filtering or
|
||||
equivalent algorithm */
|
||||
|
||||
SDL_TEXTURESCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or
|
||||
equivalent algorithm */
|
||||
} SDL_TextureScaleMode;
|
||||
|
||||
/**
|
||||
* \brief An efficient driver-specific representation of pixel data
|
||||
*/
|
||||
|
@ -986,7 +956,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
|
|||
* \sa SDL_GetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
||||
int blendMode);
|
||||
SDL_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* \brief Get the blend mode used for texture copy operations.
|
||||
|
@ -999,13 +969,13 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
|||
* \sa SDL_SetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||
int *blendMode);
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Set the scale mode used for texture copy operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param scaleMode ::SDL_TextureScaleMode to use for texture scaling.
|
||||
* \param scaleMode ::SDL_ScaleMode to use for texture scaling.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or the scale mode is
|
||||
* not supported.
|
||||
|
@ -1016,7 +986,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
|||
* \sa SDL_GetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
||||
int scaleMode);
|
||||
SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Get the scale mode used for texture copy operations.
|
||||
|
@ -1029,7 +999,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
|||
* \sa SDL_SetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
||||
int *scaleMode);
|
||||
SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Update the given texture rectangle with new pixel data.
|
||||
|
@ -1135,7 +1105,7 @@ extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
|
|||
*
|
||||
* \sa SDL_GetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
|
||||
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* \brief Get the blend mode used for drawing operations.
|
||||
|
@ -1146,7 +1116,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
|
|||
*
|
||||
* \sa SDL_SetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Clear the current rendering target with the drawing color
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue