comparison include/SDL_video.h @ 2884:9dde605c7540

Date: Fri, 19 Dec 2008 20:17:35 +0100 From: Couriersud Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions > For consistency you'd probably want: > SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a); > SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode); > SDL_RenderLine(int x1, int y1, int x2, int y2); > SDL_RenderFill(SDL_Rect *rect); > > You probably also want to add API functions query the current state. > I have implemented the above api for the opengl, x11, directfb and software renderers. I have also renamed *TEXTUREBLENDMODE* constants to BLENDMODE*. The unix build compiles. The windows renderer still needs to be updated, but I have no windows development machine at hand. Have a look at the x11 renderer for a sample. Vector games now run at 90% both on opengl and directfb in comparison to sdlmame's own opengl renderer. The same applies to raster games. The diff also includes a) Changed XDrawRect to XFillRect in x11 renderer b) A number of changes to fix blending and modulation issues in the directfb renderer.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 20 Dec 2008 12:00:00 +0000
parents 99210400e8b9
children 633ce79b7a5b
comparison
equal deleted inserted replaced
2883:11626a53e7bc 2884:9dde605c7540
204 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ 204 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
205 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ 205 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
206 } SDL_TextureModulate; 206 } SDL_TextureModulate;
207 207
208 /** 208 /**
209 * \enum SDL_TextureBlendMode 209 * \enum SDL_BlendMode
210 * 210 *
211 * \brief The texture blend mode used in SDL_RenderCopy() 211 * \brief The blend mode used in SDL_RenderCopy() and drawing operations
212 */ 212 */
213 typedef enum 213 typedef enum
214 { 214 {
215 SDL_TEXTUREBLENDMODE_NONE = 0x00000000, /**< No blending */ 215 SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
216 SDL_TEXTUREBLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst (alpha is mask) */ 216 SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst (alpha is mask) */
217 SDL_TEXTUREBLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */ 217 SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
218 SDL_TEXTUREBLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */ 218 SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
219 SDL_TEXTUREBLENDMODE_MOD = 0x00000008 /**< dst = src * dst */ 219 SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
220 } SDL_TextureBlendMode; 220 } SDL_BlendMode;
221 221
222 /** 222 /**
223 * \enum SDL_TextureScaleMode 223 * \enum SDL_TextureScaleMode
224 * 224 *
225 * \brief The texture scale mode used in SDL_RenderCopy() 225 * \brief The texture scale mode used in SDL_RenderCopy()
1139 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, 1139 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
1140 int numrects, 1140 int numrects,
1141 const SDL_Rect * rects); 1141 const SDL_Rect * rects);
1142 1142
1143 /** 1143 /**
1144 * \fn void SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect *rect) 1144 * \fn void SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1145 * 1145 *
1146 * \brief Fill the current rendering target with the specified color. 1146 * \brief Set the color used for drawing operations (Fill and Line).
1147 *
1148 * \param r The red value used to draw on the rendering target
1149 * \param g The green value used to draw on the rendering target
1150 * \param b The blue value used to draw on the rendering target
1151 * \param a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
1152 * \return 0 on success, or -1 if there is no rendering context current
1153 */
1154 extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
1155 Uint8 a);
1156
1157 /**
1158 * \fn void SDL_GetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
1159 *
1160 * \brief Get the color used for drawing operations (Fill and Line).
1161 *
1162 * \param r A pointer to the red value used to draw on the rendering target
1163 * \param g A pointer to the green value used to draw on the rendering target
1164 * \param b A pointer to the blue value used to draw on the rendering target
1165 * \param a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
1166 * \return 0 on success, or -1 if there is no rendering context current
1167 */
1168 extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
1169 Uint8 * a);
1170
1171 /**
1172 * \fn int SDL_SetRenderDrawBlendMode(int blendMode)
1173 *
1174 * \brief Set the blend mode used for drawing operations
1175 *
1176 * \param blendMode SDL_BlendMode to use for blending
1177 *
1178 * \return 0 on success, or -1 if there is no rendering context current
1179 *
1180 * \note If the blend mode is not supported, the closest supported mode is chosen.
1181 *
1182 * \sa SDL_SetRenderDrawBlendMode()
1183 */
1184 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
1185
1186 /**
1187 * \fn int SDL_GetRenderDrawBlendMode(int *blendMode)
1188 *
1189 * \brief Get the blend mode used for drawing operations
1190 *
1191 * \param blendMode A pointer filled in with the current blend mode
1192 *
1193 * \return 0 on success, or -1 if there is no rendering context current
1194 *
1195 * \sa SDL_SetRenderDrawBlendMode()
1196 */
1197 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
1198
1199 /**
1200 * \fn void SDL_RenderLine(int x1, int y1, int x2, int y2)
1201 *
1202 * \brief Draw a line on the current rendering target.
1203 *
1204 * \param x1 The x coordinate of the start point
1205 * \param y1 The y coordinate of the start point
1206 * \param x2 The x coordinate of the end point
1207 * \param y2 The y coordinate of the end point
1208 *
1209 * \return 0 on success, or -1 if there is no rendering context current
1210 */
1211
1212 extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2);
1213
1214 /**
1215 * \fn void SDL_RenderFill(const SDL_Rect *rect)
1216 *
1217 * \brief Fill the current rendering target with the drawing color.
1147 * 1218 *
1148 * \param r The red value used to fill the rendering target 1219 * \param r The red value used to fill the rendering target
1149 * \param g The green value used to fill the rendering target 1220 * \param g The green value used to fill the rendering target
1150 * \param b The blue value used to fill the rendering target 1221 * \param b The blue value used to fill the rendering target
1151 * \param a The alpha value used to fill the rendering target, usually SDL_ALPHA_OPAQUE (255) 1222 * \param a The alpha value used to fill the rendering target, usually SDL_ALPHA_OPAQUE (255)
1152 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target. 1223 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
1153 * 1224 *
1154 * \return 0 on success, or -1 if there is no rendering context current 1225 * \return 0 on success, or -1 if there is no rendering context current
1155 */ 1226 */
1156 extern DECLSPEC int SDLCALL SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, 1227 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect);
1157 const SDL_Rect * rect);
1158 1228
1159 /** 1229 /**
1160 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect) 1230 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
1161 * 1231 *
1162 * \brief Copy a portion of the texture to the current rendering target. 1232 * \brief Copy a portion of the texture to the current rendering target.