include/SDL_render.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 19 Jan 2012 21:06:47 -0500
changeset 6237 240f1bced46b
parent 6232 37e8d0736366
child 6247 b6212690f78d
permissions -rw-r--r--
Added a renderer flag to expose whether a renderer supports render to texture.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_render.h
    24  *  
    25  *  Header file for SDL 2D rendering functions.
    26  *
    27  *  This API supports the following features:
    28  *      * single pixel points
    29  *      * single pixel lines
    30  *      * filled rectangles
    31  *      * texture images
    32  *
    33  *  The primitives may be drawn in opaque, blended, or additive modes.
    34  *
    35  *  The texture images may be drawn in opaque, blended, or additive modes.
    36  *  They can have an additional color tint or alpha modulation applied to
    37  *  them, and may also be stretched with linear interpolation.
    38  *
    39  *  This API is designed to accelerate simple 2D operations. You may
    40  *  want more functionality such as rotation and particle effects and
    41  *  in that case you should use SDL's OpenGL/Direct3D support or one
    42  *  of the many good 3D engines.
    43  */
    44 
    45 #ifndef _SDL_render_h
    46 #define _SDL_render_h
    47 
    48 #include "SDL_stdinc.h"
    49 #include "SDL_rect.h"
    50 #include "SDL_video.h"
    51 
    52 #include "begin_code.h"
    53 /* Set up for C function definitions, even when using C++ */
    54 #ifdef __cplusplus
    55 /* *INDENT-OFF* */
    56 extern "C" {
    57 /* *INDENT-ON* */
    58 #endif
    59 
    60 /**
    61  *  \brief Flags used when creating a rendering context
    62  */
    63 typedef enum
    64 {
    65     SDL_RENDERER_SOFTWARE = 0x00000001,         /**< The renderer is a software fallback */ 
    66     SDL_RENDERER_ACCELERATED = 0x00000002,      /**< The renderer uses hardware 
    67                                                      acceleration */
    68     SDL_RENDERER_PRESENTVSYNC = 0x00000004,     /**< Present is synchronized 
    69                                                      with the refresh rate */
    70     SDL_RENDERER_TARGETTEXTURE = 0x00000008     /**< The renderer supports
    71                                                      rendering to texture */
    72 } SDL_RendererFlags;
    73 
    74 /**
    75  *  \brief Information on the capabilities of a render driver or context.
    76  */
    77 typedef struct SDL_RendererInfo
    78 {
    79     const char *name;           /**< The name of the renderer */
    80     Uint32 flags;               /**< Supported ::SDL_RendererFlags */
    81     Uint32 num_texture_formats; /**< The number of available texture formats */
    82     Uint32 texture_formats[16]; /**< The available texture formats */
    83     int max_texture_width;      /**< The maximimum texture width */
    84     int max_texture_height;     /**< The maximimum texture height */
    85 } SDL_RendererInfo;
    86 
    87 /**
    88  *  \brief The access pattern allowed for a texture.
    89  */
    90 typedef enum
    91 {
    92     SDL_TEXTUREACCESS_STATIC,    /**< Changes rarely, not lockable */
    93     SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
    94     SDL_TEXTUREACCESS_TARGET     /**< Texture can be used as a render target */
    95 } SDL_TextureAccess;
    96 
    97 /**
    98  *  \brief The texture channel modulation used in SDL_RenderCopy().
    99  */
   100 typedef enum
   101 {
   102     SDL_TEXTUREMODULATE_NONE = 0x00000000,     /**< No modulation */
   103     SDL_TEXTUREMODULATE_COLOR = 0x00000001,    /**< srcC = srcC * color */
   104     SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
   105 } SDL_TextureModulate;
   106 
   107 /**
   108  *  \brief A structure representing rendering state
   109  */
   110 struct SDL_Renderer;
   111 typedef struct SDL_Renderer SDL_Renderer;
   112 
   113 /**
   114  *  \brief An efficient driver-specific representation of pixel data
   115  */
   116 struct SDL_Texture;
   117 typedef struct SDL_Texture SDL_Texture;
   118 
   119 
   120 /* Function prototypes */
   121 
   122 /**
   123  *  \brief Get the number of 2D rendering drivers available for the current 
   124  *         display.
   125  *  
   126  *  A render driver is a set of code that handles rendering and texture
   127  *  management on a particular display.  Normally there is only one, but
   128  *  some drivers may have several available with different capabilities.
   129  *  
   130  *  \sa SDL_GetRenderDriverInfo()
   131  *  \sa SDL_CreateRenderer()
   132  */
   133 extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
   134 
   135 /**
   136  *  \brief Get information about a specific 2D rendering driver for the current 
   137  *         display.
   138  *  
   139  *  \param index The index of the driver to query information about.
   140  *  \param info  A pointer to an SDL_RendererInfo struct to be filled with 
   141  *               information on the rendering driver.
   142  *  
   143  *  \return 0 on success, -1 if the index was out of range.
   144  *  
   145  *  \sa SDL_CreateRenderer()
   146  */
   147 extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
   148                                                     SDL_RendererInfo * info);
   149 
   150 /**
   151  *  \brief Create a 2D rendering context for a window.
   152  *  
   153  *  \param window The window where rendering is displayed.
   154  *  \param index    The index of the rendering driver to initialize, or -1 to 
   155  *                  initialize the first one supporting the requested flags.
   156  *  \param flags    ::SDL_RendererFlags.
   157  *  
   158  *  \return A valid rendering context or NULL if there was an error.
   159  *  
   160  *  \sa SDL_CreateSoftwareRenderer()
   161  *  \sa SDL_GetRendererInfo()
   162  *  \sa SDL_DestroyRenderer()
   163  */
   164 extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
   165                                                int index, Uint32 flags);
   166 
   167 /**
   168  *  \brief Create a 2D software rendering context for a surface.
   169  *  
   170  *  \param surface The surface where rendering is done.
   171  *  
   172  *  \return A valid rendering context or NULL if there was an error.
   173  *  
   174  *  \sa SDL_CreateRenderer()
   175  *  \sa SDL_DestroyRenderer()
   176  */
   177 extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
   178 
   179 /**
   180  *  \brief Get the renderer associated with a window.
   181  */
   182 extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
   183 
   184 /**
   185  *  \brief Get information about a rendering context.
   186  */
   187 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
   188                                                 SDL_RendererInfo * info);
   189 
   190 /**
   191  *  \brief Create a texture for a rendering context.
   192  *  
   193  *  \param format The format of the texture.
   194  *  \param access One of the enumerated values in ::SDL_TextureAccess.
   195  *  \param w      The width of the texture in pixels.
   196  *  \param h      The height of the texture in pixels.
   197  *  
   198  *  \return The created texture is returned, or 0 if no rendering context was 
   199  *          active,  the format was unsupported, or the width or height were out
   200  *          of range.
   201  *  
   202  *  \sa SDL_QueryTexture()
   203  *  \sa SDL_UpdateTexture()
   204  *  \sa SDL_DestroyTexture()
   205  */
   206 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
   207                                                         Uint32 format,
   208                                                         int access, int w,
   209                                                         int h);
   210 
   211 /**
   212  *  \brief Create a texture from an existing surface.
   213  *  
   214  *  \param surface The surface containing pixel data used to fill the texture.
   215  *  
   216  *  \return The created texture is returned, or 0 on error.
   217  *  
   218  *  \note The surface is not modified or freed by this function.
   219  *  
   220  *  \sa SDL_QueryTexture()
   221  *  \sa SDL_DestroyTexture()
   222  */
   223 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
   224 
   225 /**
   226  *  \brief Query the attributes of a texture
   227  *  
   228  *  \param texture A texture to be queried.
   229  *  \param format  A pointer filled in with the raw format of the texture.  The 
   230  *                 actual format may differ, but pixel transfers will use this 
   231  *                 format.
   232  *  \param access  A pointer filled in with the actual access to the texture.
   233  *  \param w       A pointer filled in with the width of the texture in pixels.
   234  *  \param h       A pointer filled in with the height of the texture in pixels.
   235  *  
   236  *  \return 0 on success, or -1 if the texture is not valid.
   237  */
   238 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
   239                                              Uint32 * format, int *access,
   240                                              int *w, int *h);
   241 
   242 /**
   243  *  \brief Set an additional color value used in render copy operations.
   244  *  
   245  *  \param texture The texture to update.
   246  *  \param r       The red color value multiplied into copy operations.
   247  *  \param g       The green color value multiplied into copy operations.
   248  *  \param b       The blue color value multiplied into copy operations.
   249  *  
   250  *  \return 0 on success, or -1 if the texture is not valid or color modulation 
   251  *          is not supported.
   252  *  
   253  *  \sa SDL_GetTextureColorMod()
   254  */
   255 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
   256                                                    Uint8 r, Uint8 g, Uint8 b);
   257 
   258 
   259 /**
   260  *  \brief Get the additional color value used in render copy operations.
   261  *  
   262  *  \param texture The texture to query.
   263  *  \param r         A pointer filled in with the current red color value.
   264  *  \param g         A pointer filled in with the current green color value.
   265  *  \param b         A pointer filled in with the current blue color value.
   266  *  
   267  *  \return 0 on success, or -1 if the texture is not valid.
   268  *  
   269  *  \sa SDL_SetTextureColorMod()
   270  */
   271 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
   272                                                    Uint8 * r, Uint8 * g,
   273                                                    Uint8 * b);
   274 
   275 /**
   276  *  \brief Set an additional alpha value used in render copy operations.
   277  *  
   278  *  \param texture The texture to update.
   279  *  \param alpha     The alpha value multiplied into copy operations.
   280  *  
   281  *  \return 0 on success, or -1 if the texture is not valid or alpha modulation 
   282  *          is not supported.
   283  *  
   284  *  \sa SDL_GetTextureAlphaMod()
   285  */
   286 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
   287                                                    Uint8 alpha);
   288 
   289 /**
   290  *  \brief Get the additional alpha value used in render copy operations.
   291  *  
   292  *  \param texture The texture to query.
   293  *  \param alpha     A pointer filled in with the current alpha value.
   294  *  
   295  *  \return 0 on success, or -1 if the texture is not valid.
   296  *  
   297  *  \sa SDL_SetTextureAlphaMod()
   298  */
   299 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
   300                                                    Uint8 * alpha);
   301 
   302 /**
   303  *  \brief Set the blend mode used for texture copy operations.
   304  *  
   305  *  \param texture The texture to update.
   306  *  \param blendMode ::SDL_BlendMode to use for texture blending.
   307  *  
   308  *  \return 0 on success, or -1 if the texture is not valid or the blend mode is
   309  *          not supported.
   310  *  
   311  *  \note If the blend mode is not supported, the closest supported mode is
   312  *        chosen.
   313  *  
   314  *  \sa SDL_GetTextureBlendMode()
   315  */
   316 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
   317                                                     SDL_BlendMode blendMode);
   318 
   319 /**
   320  *  \brief Get the blend mode used for texture copy operations.
   321  *  
   322  *  \param texture   The texture to query.
   323  *  \param blendMode A pointer filled in with the current blend mode.
   324  *  
   325  *  \return 0 on success, or -1 if the texture is not valid.
   326  *  
   327  *  \sa SDL_SetTextureBlendMode()
   328  */
   329 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
   330                                                     SDL_BlendMode *blendMode);
   331 
   332 /**
   333  *  \brief Update the given texture rectangle with new pixel data.
   334  *  
   335  *  \param texture   The texture to update
   336  *  \param rect      A pointer to the rectangle of pixels to update, or NULL to 
   337  *                   update the entire texture.
   338  *  \param pixels    The raw pixel data.
   339  *  \param pitch     The number of bytes between rows of pixel data.
   340  *  
   341  *  \return 0 on success, or -1 if the texture is not valid.
   342  *  
   343  *  \note This is a fairly slow function.
   344  */
   345 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
   346                                               const SDL_Rect * rect,
   347                                               const void *pixels, int pitch);
   348 
   349 /**
   350  *  \brief Lock a portion of the texture for pixel access.
   351  *  
   352  *  \param texture   The texture to lock for access, which was created with 
   353  *                   ::SDL_TEXTUREACCESS_STREAMING.
   354  *  \param rect      A pointer to the rectangle to lock for access. If the rect 
   355  *                   is NULL, the entire texture will be locked.
   356  *  \param pixels    This is filled in with a pointer to the locked pixels, 
   357  *                   appropriately offset by the locked area.
   358  *  \param pitch     This is filled in with the pitch of the locked pixels.
   359  *  
   360  *  \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
   361  *  
   362  *  \sa SDL_UnlockTexture()
   363  */
   364 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
   365                                             const SDL_Rect * rect,
   366                                             void **pixels, int *pitch);
   367 
   368 /**
   369  *  \brief Unlock a texture, uploading the changes to video memory, if needed.
   370  *  
   371  *  \sa SDL_LockTexture()
   372  */
   373 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
   374 
   375 /**
   376  *  \brief Set the drawing area for rendering on the current target.
   377  *
   378  *  \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
   379  *
   380  *  The x,y of the viewport rect represents the origin for rendering.
   381  *
   382  *  \note When the window is resized, the current viewport is automatically
   383  *        centered within the new window size.
   384  */
   385 extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
   386                                                   const SDL_Rect * rect);
   387 
   388 /**
   389  *  \brief Get the drawing area for the current target.
   390  */
   391 extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
   392                                                    SDL_Rect * rect);
   393 
   394 /**
   395  *  \brief Set the color used for drawing operations (Rect, Line and Clear).
   396  *  
   397  *  \param r The red value used to draw on the rendering target.
   398  *  \param g The green value used to draw on the rendering target.
   399  *  \param b The blue value used to draw on the rendering target.
   400  *  \param a The alpha value used to draw on the rendering target, usually 
   401  *           ::SDL_ALPHA_OPAQUE (255).
   402  *  
   403  *  \return 0 on success, or -1 on error
   404  */
   405 extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
   406                                            Uint8 r, Uint8 g, Uint8 b,
   407                                            Uint8 a);
   408 
   409 /**
   410  *  \brief Get the color used for drawing operations (Rect, Line and Clear).
   411  *  
   412  *  \param r A pointer to the red value used to draw on the rendering target.
   413  *  \param g A pointer to the green value used to draw on the rendering target.
   414  *  \param b A pointer to the blue value used to draw on the rendering target.
   415  *  \param a A pointer to the alpha value used to draw on the rendering target, 
   416  *           usually ::SDL_ALPHA_OPAQUE (255).
   417  *  
   418  *  \return 0 on success, or -1 on error
   419  */
   420 extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
   421                                            Uint8 * r, Uint8 * g, Uint8 * b,
   422                                            Uint8 * a);
   423 
   424 /**
   425  *  \brief Set the blend mode used for drawing operations (Fill and Line).
   426  *  
   427  *  \param blendMode ::SDL_BlendMode to use for blending.
   428  *  
   429  *  \return 0 on success, or -1 on error
   430  *  
   431  *  \note If the blend mode is not supported, the closest supported mode is 
   432  *        chosen.
   433  *  
   434  *  \sa SDL_GetRenderDrawBlendMode()
   435  */
   436 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
   437                                                        SDL_BlendMode blendMode);
   438 
   439 /**
   440  *  \brief Get the blend mode used for drawing operations.
   441  *  
   442  *  \param blendMode A pointer filled in with the current blend mode.
   443  *  
   444  *  \return 0 on success, or -1 on error
   445  *  
   446  *  \sa SDL_SetRenderDrawBlendMode()
   447  */
   448 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
   449                                                        SDL_BlendMode *blendMode);
   450 
   451 /**
   452  *  \brief Clear the current rendering target with the drawing color
   453  *
   454  *  This function clears the entire rendering target, ignoring the viewport.
   455  */
   456 extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
   457 
   458 /**
   459  *  \brief Draw a point on the current rendering target.
   460  *  
   461  *  \param x The x coordinate of the point.
   462  *  \param y The y coordinate of the point.
   463  *  
   464  *  \return 0 on success, or -1 on error
   465  */
   466 extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
   467                                                 int x, int y);
   468 
   469 /**
   470  *  \brief Draw multiple points on the current rendering target.
   471  *  
   472  *  \param points The points to draw
   473  *  \param count The number of points to draw
   474  *  
   475  *  \return 0 on success, or -1 on error
   476  */
   477 extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
   478                                                  const SDL_Point * points,
   479                                                  int count);
   480 
   481 /**
   482  *  \brief Draw a line on the current rendering target.
   483  *  
   484  *  \param x1 The x coordinate of the start point.
   485  *  \param y1 The y coordinate of the start point.
   486  *  \param x2 The x coordinate of the end point.
   487  *  \param y2 The y coordinate of the end point.
   488  *  
   489  *  \return 0 on success, or -1 on error
   490  */
   491 extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
   492                                                int x1, int y1, int x2, int y2);
   493 
   494 /**
   495  *  \brief Draw a series of connected lines on the current rendering target.
   496  *  
   497  *  \param points The points along the lines
   498  *  \param count The number of points, drawing count-1 lines
   499  *  
   500  *  \return 0 on success, or -1 on error
   501  */
   502 extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
   503                                                 const SDL_Point * points,
   504                                                 int count);
   505 
   506 /**
   507  *  \brief Draw a rectangle on the current rendering target.
   508  *  
   509  *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
   510  *  
   511  *  \return 0 on success, or -1 on error
   512  */
   513 extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
   514                                                const SDL_Rect * rect);
   515 
   516 /**
   517  *  \brief Draw some number of rectangles on the current rendering target.
   518  *  
   519  *  \param rects A pointer to an array of destination rectangles.
   520  *  \param count The number of rectangles.
   521  *  
   522  *  \return 0 on success, or -1 on error
   523  */
   524 extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
   525                                                 const SDL_Rect * rects,
   526                                                 int count);
   527 
   528 /**
   529  *  \brief Fill a rectangle on the current rendering target with the drawing color.
   530  *  
   531  *  \param rect A pointer to the destination rectangle, or NULL for the entire 
   532  *              rendering target.
   533  *  
   534  *  \return 0 on success, or -1 on error
   535  */
   536 extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
   537                                                const SDL_Rect * rect);
   538 
   539 /**
   540  *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
   541  *  
   542  *  \param rects A pointer to an array of destination rectangles.
   543  *  \param count The number of rectangles.
   544  *  
   545  *  \return 0 on success, or -1 on error
   546  */
   547 extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
   548                                                 const SDL_Rect * rects,
   549                                                 int count);
   550 
   551 /**
   552  *  \brief Copy a portion of the texture to the current rendering target.
   553  *  
   554  *  \param texture The source texture.
   555  *  \param srcrect   A pointer to the source rectangle, or NULL for the entire 
   556  *                   texture.
   557  *  \param dstrect   A pointer to the destination rectangle, or NULL for the 
   558  *                   entire rendering target.
   559  *  
   560  *  \return 0 on success, or -1 on error
   561  */
   562 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
   563                                            SDL_Texture * texture,
   564                                            const SDL_Rect * srcrect,
   565                                            const SDL_Rect * dstrect);
   566 
   567 
   568 /**
   569  * \fn SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
   570  *
   571  * \brief Determines whether a window supports the use of render targets
   572  *
   573  * \param renderer The renderer that will be checked
   574  *
   575  * \return SDL_TRUE if supported, SDL_FALSE if not.
   576  */
   577 extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
   578 
   579 /**
   580  * \fn int SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture)
   581  *
   582  * \brief Set a texture as the current rendering target.
   583  *
   584  * \param renderer The renderer that will be checked
   585  *
   586  * \param texture The targeted texture, or NULL for the default render target
   587  *
   588  * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.
   589  */
   590 extern DECLSPEC int SDLCALL SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture);
   591 
   592 /**
   593  *  \brief Read pixels from the current rendering target.
   594  *  
   595  *  \param rect   A pointer to the rectangle to read, or NULL for the entire 
   596  *                render target.
   597  *  \param format The desired format of the pixel data, or 0 to use the format
   598  *                of the rendering target
   599  *  \param pixels A pointer to be filled in with the pixel data
   600  *  \param pitch  The pitch of the pixels parameter.
   601  *  
   602  *  \return 0 on success, or -1 if pixel reading is not supported.
   603  *  
   604  *  \warning This is a very slow operation, and should not be used frequently.
   605  */
   606 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
   607                                                  const SDL_Rect * rect,
   608                                                  Uint32 format,
   609                                                  void *pixels, int pitch);
   610 
   611 /**
   612  *  \brief Update the screen with rendering performed.
   613  */
   614 extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
   615 
   616 /**
   617  *  \brief Destroy the specified texture.
   618  *  
   619  *  \sa SDL_CreateTexture()
   620  *  \sa SDL_CreateTextureFromSurface()
   621  */
   622 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
   623 
   624 /**
   625  *  \brief Destroy the rendering context for a window and free associated
   626  *         textures.
   627  *  
   628  *  \sa SDL_CreateRenderer()
   629  */
   630 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
   631 
   632 
   633 /* Ends C function definitions when using C++ */
   634 #ifdef __cplusplus
   635 /* *INDENT-OFF* */
   636 }
   637 /* *INDENT-ON* */
   638 #endif
   639 #include "close_code.h"
   640 
   641 #endif /* _SDL_render_h */
   642 
   643 /* vi: set ts=4 sw=4 expandtab: */