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