comparison include/SDL_video.h @ 4929:aa8888658021

Use the enumerated type for blend and scale mode instead of int Renamed SDL_TextureScaleMode to SDL_ScaleMode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Dec 2010 15:19:05 -0800
parents 0a77d2fc95ad
children 158bb5752974
comparison
equal deleted inserted replaced
4927:d716dff4b13e 4929:aa8888658021
30 #define _SDL_video_h 30 #define _SDL_video_h
31 31
32 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
33 #include "SDL_pixels.h" 33 #include "SDL_pixels.h"
34 #include "SDL_rect.h" 34 #include "SDL_rect.h"
35 #include "SDL_blendmode.h"
36 #include "SDL_scalemode.h"
35 #include "SDL_surface.h" 37 #include "SDL_surface.h"
36 38
37 #include "begin_code.h" 39 #include "begin_code.h"
38 /* Set up for C function definitions, even when using C++ */ 40 /* Set up for C function definitions, even when using C++ */
39 #ifdef __cplusplus 41 #ifdef __cplusplus
212 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ 214 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
213 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ 215 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
214 } SDL_TextureModulate; 216 } SDL_TextureModulate;
215 217
216 /** 218 /**
217 * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
218 */
219 typedef enum
220 {
221 SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
222 SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst
223 (alpha is mask) */
224
225 SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
226 SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
227 SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
228 } SDL_BlendMode;
229
230 /**
231 * \brief The texture scale mode used in SDL_RenderCopy().
232 */
233 typedef enum
234 {
235 SDL_TEXTURESCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must
236 match dimensions */
237
238 SDL_TEXTURESCALEMODE_FAST = 0x00000001, /**< Point sampling or
239 equivalent algorithm */
240
241 SDL_TEXTURESCALEMODE_SLOW = 0x00000002, /**< Linear filtering or
242 equivalent algorithm */
243
244 SDL_TEXTURESCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or
245 equivalent algorithm */
246 } SDL_TextureScaleMode;
247
248 /**
249 * \brief An efficient driver-specific representation of pixel data 219 * \brief An efficient driver-specific representation of pixel data
250 */ 220 */
251 struct SDL_Texture; 221 struct SDL_Texture;
252 typedef struct SDL_Texture SDL_Texture; 222 typedef struct SDL_Texture SDL_Texture;
253 223
984 * chosen. 954 * chosen.
985 * 955 *
986 * \sa SDL_GetTextureBlendMode() 956 * \sa SDL_GetTextureBlendMode()
987 */ 957 */
988 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, 958 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
989 int blendMode); 959 SDL_BlendMode blendMode);
990 960
991 /** 961 /**
992 * \brief Get the blend mode used for texture copy operations. 962 * \brief Get the blend mode used for texture copy operations.
993 * 963 *
994 * \param texture The texture to query. 964 * \param texture The texture to query.
997 * \return 0 on success, or -1 if the texture is not valid. 967 * \return 0 on success, or -1 if the texture is not valid.
998 * 968 *
999 * \sa SDL_SetTextureBlendMode() 969 * \sa SDL_SetTextureBlendMode()
1000 */ 970 */
1001 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, 971 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
1002 int *blendMode); 972 SDL_BlendMode *blendMode);
1003 973
1004 /** 974 /**
1005 * \brief Set the scale mode used for texture copy operations. 975 * \brief Set the scale mode used for texture copy operations.
1006 * 976 *
1007 * \param texture The texture to update. 977 * \param texture The texture to update.
1008 * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling. 978 * \param scaleMode ::SDL_ScaleMode to use for texture scaling.
1009 * 979 *
1010 * \return 0 on success, or -1 if the texture is not valid or the scale mode is 980 * \return 0 on success, or -1 if the texture is not valid or the scale mode is
1011 * not supported. 981 * not supported.
1012 * 982 *
1013 * \note If the scale mode is not supported, the closest supported mode is 983 * \note If the scale mode is not supported, the closest supported mode is
1014 * chosen. 984 * chosen.
1015 * 985 *
1016 * \sa SDL_GetTextureScaleMode() 986 * \sa SDL_GetTextureScaleMode()
1017 */ 987 */
1018 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, 988 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
1019 int scaleMode); 989 SDL_ScaleMode scaleMode);
1020 990
1021 /** 991 /**
1022 * \brief Get the scale mode used for texture copy operations. 992 * \brief Get the scale mode used for texture copy operations.
1023 * 993 *
1024 * \param texture The texture to query. 994 * \param texture The texture to query.
1027 * \return 0 on success, or -1 if the texture is not valid. 997 * \return 0 on success, or -1 if the texture is not valid.
1028 * 998 *
1029 * \sa SDL_SetTextureScaleMode() 999 * \sa SDL_SetTextureScaleMode()
1030 */ 1000 */
1031 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, 1001 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
1032 int *scaleMode); 1002 SDL_ScaleMode *scaleMode);
1033 1003
1034 /** 1004 /**
1035 * \brief Update the given texture rectangle with new pixel data. 1005 * \brief Update the given texture rectangle with new pixel data.
1036 * 1006 *
1037 * \param texture The texture to update 1007 * \param texture The texture to update
1133 * \note If the blend mode is not supported, the closest supported mode is 1103 * \note If the blend mode is not supported, the closest supported mode is
1134 * chosen. 1104 * chosen.
1135 * 1105 *
1136 * \sa SDL_GetRenderDrawBlendMode() 1106 * \sa SDL_GetRenderDrawBlendMode()
1137 */ 1107 */
1138 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode); 1108 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
1139 1109
1140 /** 1110 /**
1141 * \brief Get the blend mode used for drawing operations. 1111 * \brief Get the blend mode used for drawing operations.
1142 * 1112 *
1143 * \param blendMode A pointer filled in with the current blend mode. 1113 * \param blendMode A pointer filled in with the current blend mode.
1144 * 1114 *
1145 * \return 0 on success, or -1 if there is no rendering context current. 1115 * \return 0 on success, or -1 if there is no rendering context current.
1146 * 1116 *
1147 * \sa SDL_SetRenderDrawBlendMode() 1117 * \sa SDL_SetRenderDrawBlendMode()
1148 */ 1118 */
1149 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode); 1119 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_BlendMode *blendMode);
1150 1120
1151 /** 1121 /**
1152 * \brief Clear the current rendering target with the drawing color 1122 * \brief Clear the current rendering target with the drawing color
1153 */ 1123 */
1154 extern DECLSPEC int SDLCALL SDL_RenderClear(void); 1124 extern DECLSPEC int SDLCALL SDL_RenderClear(void);