include/SDL_render.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Jan 2012 22:45:49 -0500
changeset 6232 37e8d0736366
parent 6138 4c64952a58fb
child 6237 240f1bced46b
permissions -rw-r--r--
Implementation of render targets, by Mason Wheeler and Gabriel Jacobo

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