comparison include/SDL_render.h @ 5159:307ccc9c135e

Made it possible to create a texture of any format, even if not supported by the renderer. This allows me to reduce the set of formats supported by the renderers to the most optimal set, for a nice speed boost.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Feb 2011 00:19:40 -0800
parents be02be2ea897
children 657543cc92f9
comparison
equal deleted inserted replaced
5158:f3ebd1950442 5159:307ccc9c135e
59 typedef struct SDL_RendererInfo 59 typedef struct SDL_RendererInfo
60 { 60 {
61 const char *name; /**< The name of the renderer */ 61 const char *name; /**< The name of the renderer */
62 Uint32 flags; /**< Supported ::SDL_RendererFlags */ 62 Uint32 flags; /**< Supported ::SDL_RendererFlags */
63 Uint32 num_texture_formats; /**< The number of available texture formats */ 63 Uint32 num_texture_formats; /**< The number of available texture formats */
64 Uint32 texture_formats[50]; /**< The available texture formats */ 64 Uint32 texture_formats[16]; /**< The available texture formats */
65 int max_texture_width; /**< The maximimum texture width */ 65 int max_texture_width; /**< The maximimum texture width */
66 int max_texture_height; /**< The maximimum texture height */ 66 int max_texture_height; /**< The maximimum texture height */
67 } SDL_RendererInfo; 67 } SDL_RendererInfo;
68 68
69 /** 69 /**
202 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, 202 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
203 Uint32 * format, int *access, 203 Uint32 * format, int *access,
204 int *w, int *h); 204 int *w, int *h);
205 205
206 /** 206 /**
207 * \brief Query the pixels of a texture, if the texture does not need to be
208 * locked for pixel access.
209 *
210 * \param texture A texture to be queried, which was created with
211 * ::SDL_TEXTUREACCESS_STREAMING.
212 * \param pixels A pointer filled with a pointer to the pixels for the
213 * texture.
214 * \param pitch A pointer filled in with the pitch of the pixel data.
215 *
216 * \return 0 on success, or -1 if the texture is not valid, or must be locked
217 * for pixel access.
218 */
219 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
220 void **pixels, int *pitch);
221
222 /**
223 * \brief Set an additional color value used in render copy operations. 207 * \brief Set an additional color value used in render copy operations.
224 * 208 *
225 * \param texture The texture to update. 209 * \param texture The texture to update.
226 * \param r The red color value multiplied into copy operations. 210 * \param r The red color value multiplied into copy operations.
227 * \param g The green color value multiplied into copy operations. 211 * \param g The green color value multiplied into copy operations.
297 SDL_BlendMode blendMode); 281 SDL_BlendMode blendMode);
298 282
299 /** 283 /**
300 * \brief Get the blend mode used for texture copy operations. 284 * \brief Get the blend mode used for texture copy operations.
301 * 285 *
302 * \param texture The texture to query. 286 * \param texture The texture to query.
303 * \param blendMode A pointer filled in with the current blend mode. 287 * \param blendMode A pointer filled in with the current blend mode.
304 * 288 *
305 * \return 0 on success, or -1 if the texture is not valid. 289 * \return 0 on success, or -1 if the texture is not valid.
306 * 290 *
307 * \sa SDL_SetTextureBlendMode() 291 * \sa SDL_SetTextureBlendMode()
310 SDL_BlendMode *blendMode); 294 SDL_BlendMode *blendMode);
311 295
312 /** 296 /**
313 * \brief Update the given texture rectangle with new pixel data. 297 * \brief Update the given texture rectangle with new pixel data.
314 * 298 *
315 * \param texture The texture to update 299 * \param texture The texture to update
316 * \param rect A pointer to the rectangle of pixels to update, or NULL to 300 * \param rect A pointer to the rectangle of pixels to update, or NULL to
317 * update the entire texture. 301 * update the entire texture.
318 * \param pixels The raw pixel data. 302 * \param pixels The raw pixel data.
319 * \param pitch The number of bytes between rows of pixel data. 303 * \param pitch The number of bytes between rows of pixel data.
320 * 304 *
327 const void *pixels, int pitch); 311 const void *pixels, int pitch);
328 312
329 /** 313 /**
330 * \brief Lock a portion of the texture for pixel access. 314 * \brief Lock a portion of the texture for pixel access.
331 * 315 *
332 * \param texture The texture to lock for access, which was created with 316 * \param texture The texture to lock for access, which was created with
333 * ::SDL_TEXTUREACCESS_STREAMING. 317 * ::SDL_TEXTUREACCESS_STREAMING.
334 * \param rect A pointer to the rectangle to lock for access. If the rect 318 * \param rect A pointer to the rectangle to lock for access. If the rect
335 * is NULL, the entire texture will be locked. 319 * is NULL, the entire texture will be locked.
336 * \param markDirty If this is nonzero, the locked area will be marked dirty
337 * when the texture is unlocked.
338 * \param pixels This is filled in with a pointer to the locked pixels, 320 * \param pixels This is filled in with a pointer to the locked pixels,
339 * appropriately offset by the locked area. 321 * appropriately offset by the locked area.
340 * \param pitch This is filled in with the pitch of the locked pixels. 322 * \param pitch This is filled in with the pitch of the locked pixels.
341 * 323 *
342 * \return 0 on success, or -1 if the texture is not valid or was created with 324 * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
343 * ::SDL_TEXTUREACCESS_STATIC. 325 *
344 *
345 * \sa SDL_DirtyTexture()
346 * \sa SDL_UnlockTexture() 326 * \sa SDL_UnlockTexture()
347 */ 327 */
348 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, 328 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
349 const SDL_Rect * rect, 329 const SDL_Rect * rect,
350 int markDirty, void **pixels, 330 void **pixels, int *pitch);
351 int *pitch); 331
352 332 /**
353 /** 333 * \brief Unlock a texture, uploading the changes to video memory, if needed.
354 * \brief Unlock a texture, uploading the changes to renderer memory, if needed.
355 * 334 *
356 * \sa SDL_LockTexture() 335 * \sa SDL_LockTexture()
357 * \sa SDL_DirtyTexture()
358 */ 336 */
359 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); 337 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
360
361 /**
362 * \brief Mark the specified rectangles of the texture as dirty.
363 *
364 * \param texture The texture to mark dirty, which was created with
365 * ::SDL_TEXTUREACCESS_STREAMING.
366 * \param numrects The number of rectangles pointed to by rects.
367 * \param rects The pointer to an array of dirty rectangles.
368 *
369 * \sa SDL_LockTexture()
370 * \sa SDL_UnlockTexture()
371 */
372 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
373 int numrects,
374 const SDL_Rect * rects);
375 338
376 /** 339 /**
377 * \brief Set the color used for drawing operations (Fill and Line). 340 * \brief Set the color used for drawing operations (Fill and Line).
378 * 341 *
379 * \param r The red value used to draw on the rendering target. 342 * \param r The red value used to draw on the rendering target.