include/SDL_render.h
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 18 May 2013 14:48:19 +0200
changeset 7188 20bd120bf7e4
parent 7175 45276691c8c8
child 7191 75360622e65f
permissions -rw-r--r--
Fixed Doxygen warnings.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2013 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 Flip constants for SDL_RenderCopyEx
   109  */
   110 typedef enum
   111 {
   112     SDL_FLIP_NONE = 0x00000000,     /**< Do not flip */
   113     SDL_FLIP_HORIZONTAL = 0x00000001,    /**< flip horizontally */
   114     SDL_FLIP_VERTICAL = 0x00000002     /**< flip vertically */
   115 } SDL_RendererFlip;
   116 
   117 /**
   118  *  \brief A structure representing rendering state
   119  */
   120 struct SDL_Renderer;
   121 typedef struct SDL_Renderer SDL_Renderer;
   122 
   123 /**
   124  *  \brief An efficient driver-specific representation of pixel data
   125  */
   126 struct SDL_Texture;
   127 typedef struct SDL_Texture SDL_Texture;
   128 
   129 
   130 /* Function prototypes */
   131 
   132 /**
   133  *  \brief Get the number of 2D rendering drivers available for the current 
   134  *         display.
   135  *  
   136  *  A render driver is a set of code that handles rendering and texture
   137  *  management on a particular display.  Normally there is only one, but
   138  *  some drivers may have several available with different capabilities.
   139  *  
   140  *  \sa SDL_GetRenderDriverInfo()
   141  *  \sa SDL_CreateRenderer()
   142  */
   143 extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
   144 
   145 /**
   146  *  \brief Get information about a specific 2D rendering driver for the current 
   147  *         display.
   148  *  
   149  *  \param index The index of the driver to query information about.
   150  *  \param info  A pointer to an SDL_RendererInfo struct to be filled with 
   151  *               information on the rendering driver.
   152  *  
   153  *  \return 0 on success, -1 if the index was out of range.
   154  *  
   155  *  \sa SDL_CreateRenderer()
   156  */
   157 extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
   158                                                     SDL_RendererInfo * info);
   159 
   160 /**
   161  *  \brief Create a window and default renderer
   162  *
   163  *  \param width    The width of the window
   164  *  \param height   The height of the window
   165  *  \param window_flags The flags used to create the window
   166  *  \param window   A pointer filled with the window, or NULL on error
   167  *  \param renderer A pointer filled with the renderer, or NULL on error
   168  *
   169  *  \return 0 on success, or -1 on error
   170  */
   171 extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
   172                                 int width, int height, Uint32 window_flags,
   173                                 SDL_Window **window, SDL_Renderer **renderer);
   174 
   175 
   176 /**
   177  *  \brief Create a 2D rendering context for a window.
   178  *  
   179  *  \param window The window where rendering is displayed.
   180  *  \param index    The index of the rendering driver to initialize, or -1 to 
   181  *                  initialize the first one supporting the requested flags.
   182  *  \param flags    ::SDL_RendererFlags.
   183  *  
   184  *  \return A valid rendering context or NULL if there was an error.
   185  *  
   186  *  \sa SDL_CreateSoftwareRenderer()
   187  *  \sa SDL_GetRendererInfo()
   188  *  \sa SDL_DestroyRenderer()
   189  */
   190 extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
   191                                                int index, Uint32 flags);
   192 
   193 /**
   194  *  \brief Create a 2D software rendering context for a surface.
   195  *  
   196  *  \param surface The surface where rendering is done.
   197  *  
   198  *  \return A valid rendering context or NULL if there was an error.
   199  *  
   200  *  \sa SDL_CreateRenderer()
   201  *  \sa SDL_DestroyRenderer()
   202  */
   203 extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
   204 
   205 /**
   206  *  \brief Get the renderer associated with a window.
   207  */
   208 extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
   209 
   210 /**
   211  *  \brief Get information about a rendering context.
   212  */
   213 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
   214                                                 SDL_RendererInfo * info);
   215 
   216 /**
   217  *  \brief Create a texture for a rendering context.
   218  *  
   219  *  \param renderer The renderer.
   220  *  \param format The format of the texture.
   221  *  \param access One of the enumerated values in ::SDL_TextureAccess.
   222  *  \param w      The width of the texture in pixels.
   223  *  \param h      The height of the texture in pixels.
   224  *  
   225  *  \return The created texture is returned, or 0 if no rendering context was 
   226  *          active,  the format was unsupported, or the width or height were out
   227  *          of range.
   228  *  
   229  *  \sa SDL_QueryTexture()
   230  *  \sa SDL_UpdateTexture()
   231  *  \sa SDL_DestroyTexture()
   232  */
   233 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
   234                                                         Uint32 format,
   235                                                         int access, int w,
   236                                                         int h);
   237 
   238 /**
   239  *  \brief Create a texture from an existing surface.
   240  *  
   241  *  \param renderer The renderer.
   242  *  \param surface The surface containing pixel data used to fill the texture.
   243  *  
   244  *  \return The created texture is returned, or 0 on error.
   245  *  
   246  *  \note The surface is not modified or freed by this function.
   247  *  
   248  *  \sa SDL_QueryTexture()
   249  *  \sa SDL_DestroyTexture()
   250  */
   251 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
   252 
   253 /**
   254  *  \brief Query the attributes of a texture
   255  *  
   256  *  \param texture A texture to be queried.
   257  *  \param format  A pointer filled in with the raw format of the texture.  The 
   258  *                 actual format may differ, but pixel transfers will use this 
   259  *                 format.
   260  *  \param access  A pointer filled in with the actual access to the texture.
   261  *  \param w       A pointer filled in with the width of the texture in pixels.
   262  *  \param h       A pointer filled in with the height of the texture in pixels.
   263  *  
   264  *  \return 0 on success, or -1 if the texture is not valid.
   265  */
   266 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
   267                                              Uint32 * format, int *access,
   268                                              int *w, int *h);
   269 
   270 /**
   271  *  \brief Set an additional color value used in render copy operations.
   272  *  
   273  *  \param texture The texture to update.
   274  *  \param r       The red color value multiplied into copy operations.
   275  *  \param g       The green color value multiplied into copy operations.
   276  *  \param b       The blue color value multiplied into copy operations.
   277  *  
   278  *  \return 0 on success, or -1 if the texture is not valid or color modulation 
   279  *          is not supported.
   280  *  
   281  *  \sa SDL_GetTextureColorMod()
   282  */
   283 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
   284                                                    Uint8 r, Uint8 g, Uint8 b);
   285 
   286 
   287 /**
   288  *  \brief Get the additional color value used in render copy operations.
   289  *  
   290  *  \param texture The texture to query.
   291  *  \param r         A pointer filled in with the current red color value.
   292  *  \param g         A pointer filled in with the current green color value.
   293  *  \param b         A pointer filled in with the current blue color value.
   294  *  
   295  *  \return 0 on success, or -1 if the texture is not valid.
   296  *  
   297  *  \sa SDL_SetTextureColorMod()
   298  */
   299 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
   300                                                    Uint8 * r, Uint8 * g,
   301                                                    Uint8 * b);
   302 
   303 /**
   304  *  \brief Set an additional alpha value used in render copy operations.
   305  *  
   306  *  \param texture The texture to update.
   307  *  \param alpha     The alpha value multiplied into copy operations.
   308  *  
   309  *  \return 0 on success, or -1 if the texture is not valid or alpha modulation 
   310  *          is not supported.
   311  *  
   312  *  \sa SDL_GetTextureAlphaMod()
   313  */
   314 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
   315                                                    Uint8 alpha);
   316 
   317 /**
   318  *  \brief Get the additional alpha value used in render copy operations.
   319  *  
   320  *  \param texture The texture to query.
   321  *  \param alpha     A pointer filled in with the current alpha value.
   322  *  
   323  *  \return 0 on success, or -1 if the texture is not valid.
   324  *  
   325  *  \sa SDL_SetTextureAlphaMod()
   326  */
   327 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
   328                                                    Uint8 * alpha);
   329 
   330 /**
   331  *  \brief Set the blend mode used for texture copy operations.
   332  *  
   333  *  \param texture The texture to update.
   334  *  \param blendMode ::SDL_BlendMode to use for texture blending.
   335  *  
   336  *  \return 0 on success, or -1 if the texture is not valid or the blend mode is
   337  *          not supported.
   338  *  
   339  *  \note If the blend mode is not supported, the closest supported mode is
   340  *        chosen.
   341  *  
   342  *  \sa SDL_GetTextureBlendMode()
   343  */
   344 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
   345                                                     SDL_BlendMode blendMode);
   346 
   347 /**
   348  *  \brief Get the blend mode used for texture copy operations.
   349  *  
   350  *  \param texture   The texture to query.
   351  *  \param blendMode A pointer filled in with the current blend mode.
   352  *  
   353  *  \return 0 on success, or -1 if the texture is not valid.
   354  *  
   355  *  \sa SDL_SetTextureBlendMode()
   356  */
   357 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
   358                                                     SDL_BlendMode *blendMode);
   359 
   360 /**
   361  *  \brief Update the given texture rectangle with new pixel data.
   362  *  
   363  *  \param texture   The texture to update
   364  *  \param rect      A pointer to the rectangle of pixels to update, or NULL to 
   365  *                   update the entire texture.
   366  *  \param pixels    The raw pixel data.
   367  *  \param pitch     The number of bytes between rows of pixel data.
   368  *  
   369  *  \return 0 on success, or -1 if the texture is not valid.
   370  *  
   371  *  \note This is a fairly slow function.
   372  */
   373 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
   374                                               const SDL_Rect * rect,
   375                                               const void *pixels, int pitch);
   376 
   377 /**
   378  *  \brief Lock a portion of the texture for write-only pixel access.
   379  *  
   380  *  \param texture   The texture to lock for access, which was created with 
   381  *                   ::SDL_TEXTUREACCESS_STREAMING.
   382  *  \param rect      A pointer to the rectangle to lock for access. If the rect 
   383  *                   is NULL, the entire texture will be locked.
   384  *  \param pixels    This is filled in with a pointer to the locked pixels, 
   385  *                   appropriately offset by the locked area.
   386  *  \param pitch     This is filled in with the pitch of the locked pixels.
   387  *  
   388  *  \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
   389  *  
   390  *  \sa SDL_UnlockTexture()
   391  */
   392 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
   393                                             const SDL_Rect * rect,
   394                                             void **pixels, int *pitch);
   395 
   396 /**
   397  *  \brief Unlock a texture, uploading the changes to video memory, if needed.
   398  *  
   399  *  \sa SDL_LockTexture()
   400  */
   401 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
   402 
   403 /**
   404  * \brief Determines whether a window supports the use of render targets
   405  *
   406  * \param renderer The renderer that will be checked
   407  *
   408  * \return SDL_TRUE if supported, SDL_FALSE if not.
   409  */
   410 extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
   411 
   412 /**
   413  * \brief Set a texture as the current rendering target.
   414  *
   415  * \param renderer The renderer.
   416  * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
   417  *
   418  * \return 0 on success, or -1 on error
   419  *
   420  *  \sa SDL_GetRenderTarget()
   421  */
   422 extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
   423                                                 SDL_Texture *texture);
   424 
   425 /**
   426  * \brief Get the current render target or NULL for the default render target.
   427  *
   428  * \return The current render target
   429  *
   430  *  \sa SDL_SetRenderTarget()
   431  */
   432 extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
   433 
   434 /**
   435  *  \brief Set device independent resolution for rendering
   436  *
   437  *  \param renderer The renderer for which resolution should be set.
   438  *  \param w      The width of the logical resolution
   439  *  \param h      The height of the logical resolution
   440  *
   441  *  This function uses the viewport and scaling functionality to allow a fixed logical
   442  *  resolution for rendering, regardless of the actual output resolution.  If the actual
   443  *  output resolution doesn't have the same aspect ratio the output rendering will be
   444  *  centered within the output display.
   445  *
   446  *  If the output display is a window, mouse events in the window will be filtered
   447  *  and scaled so they seem to arrive within the logical resolution.
   448  *
   449  *  \note If this function results in scaling or subpixel drawing by the 
   450  *        rendering backend, it will be handled using the appropriate
   451  *        quality hints.
   452  *
   453  *  \sa SDL_RenderGetLogicalSize()
   454  *  \sa SDL_RenderSetScale()
   455  *  \sa SDL_RenderSetViewport()
   456  */
   457 extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
   458 
   459 /**
   460  *  \brief Get device independent resolution for rendering
   461  *
   462  *  \param renderer The renderer from which resolution should be queried.
   463  *  \param w      A pointer filled with the width of the logical resolution
   464  *  \param h      A pointer filled with the height of the logical resolution
   465  *
   466  *  \sa SDL_RenderSetLogicalSize()
   467  */
   468 extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
   469 
   470 /**
   471  *  \brief Set the drawing area for rendering on the current target.
   472  *
   473  *  \param renderer The renderer for which the drawing area should be set.
   474  *  \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
   475  *
   476  *  The x,y of the viewport rect represents the origin for rendering.
   477  *
   478  *  \return 0 on success, or -1 on error
   479  *
   480  *  \note When the window is resized, the current viewport is automatically
   481  *        centered within the new window size.
   482  *
   483  *  \sa SDL_RenderGetViewport()
   484  *  \sa SDL_RenderSetLogicalSize()
   485  */
   486 extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
   487                                                   const SDL_Rect * rect);
   488 
   489 /**
   490  *  \brief Get the drawing area for the current target.
   491  *
   492  *  \sa SDL_RenderSetViewport()
   493  */
   494 extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
   495                                                    SDL_Rect * rect);
   496 
   497 /**
   498  *  \brief Set the clip rectangle for the current target.
   499  *  
   500  *  \param renderer The renderer for which clip rectangle should be set.
   501  *  \param rect   A pointer to the rectangle to set as the clip rectangle, or
   502  *                NULL to disable clipping.
   503  *
   504  *  \return 0 on success, or -1 on error
   505  *
   506  *  \sa SDL_RenderGetClipRect()
   507  */
   508 extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
   509                                                   const SDL_Rect * rect);
   510 
   511 /**
   512  *  \brief Get the clip rectangle for the current target.
   513  *  
   514  *  \param renderer The renderer from which clip rectangle should be queried.
   515  *  \param rect   A pointer filled in with the current clip rectangle, or
   516  *                an empty rectangle if clipping is disabled.
   517  *
   518  *  \sa SDL_RenderSetClipRect()
   519  */
   520 extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
   521                                                    SDL_Rect * rect);
   522 
   523 /**
   524  *  \brief Set the drawing scale for rendering on the current target.
   525  *
   526  *  \param renderer The renderer for which the drawing scale should be set.
   527  *  \param scaleX The horizontal scaling factor
   528  *  \param scaleY The vertical scaling factor
   529  *
   530  *  The drawing coordinates are scaled by the x/y scaling factors
   531  *  before they are used by the renderer.  This allows resolution
   532  *  independent drawing with a single coordinate system.
   533  *
   534  *  \note If this results in scaling or subpixel drawing by the 
   535  *        rendering backend, it will be handled using the appropriate
   536  *        quality hints.  For best results use integer scaling factors.
   537  *
   538  *  \sa SDL_RenderGetScale()
   539  *  \sa SDL_RenderSetLogicalSize()
   540  */
   541 extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
   542                                                float scaleX, float scaleY);
   543 
   544 /**
   545  *  \brief Get the drawing scale for the current target.
   546  *
   547  *  \param renderer The renderer from which drawing scale should be queried.
   548  *  \param scaleX A pointer filled in with the horizontal scaling factor
   549  *  \param scaleY A pointer filled in with the vertical scaling factor
   550  *
   551  *  \sa SDL_RenderSetScale()
   552  */
   553 extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
   554                                                float *scaleX, float *scaleY);
   555 
   556 /**
   557  *  \brief Set the color used for drawing operations (Rect, Line and Clear).
   558  *  
   559  *  \param renderer The renderer for which drawing color should be set.
   560  *  \param r The red value used to draw on the rendering target.
   561  *  \param g The green value used to draw on the rendering target.
   562  *  \param b The blue value used to draw on the rendering target.
   563  *  \param a The alpha value used to draw on the rendering target, usually 
   564  *           ::SDL_ALPHA_OPAQUE (255).
   565  *  
   566  *  \return 0 on success, or -1 on error
   567  */
   568 extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
   569                                            Uint8 r, Uint8 g, Uint8 b,
   570                                            Uint8 a);
   571 
   572 /**
   573  *  \brief Get the color used for drawing operations (Rect, Line and Clear).
   574  *  
   575  *  \param renderer The renderer from which drawing color should be queried.
   576  *  \param r A pointer to the red value used to draw on the rendering target.
   577  *  \param g A pointer to the green value used to draw on the rendering target.
   578  *  \param b A pointer to the blue value used to draw on the rendering target.
   579  *  \param a A pointer to the alpha value used to draw on the rendering target, 
   580  *           usually ::SDL_ALPHA_OPAQUE (255).
   581  *  
   582  *  \return 0 on success, or -1 on error
   583  */
   584 extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
   585                                            Uint8 * r, Uint8 * g, Uint8 * b,
   586                                            Uint8 * a);
   587 
   588 /**
   589  *  \brief Set the blend mode used for drawing operations (Fill and Line).
   590  *  
   591  *  \param renderer The renderer for which blend mode should be set.
   592  *  \param blendMode ::SDL_BlendMode to use for blending.
   593  *  
   594  *  \return 0 on success, or -1 on error
   595  *  
   596  *  \note If the blend mode is not supported, the closest supported mode is 
   597  *        chosen.
   598  *  
   599  *  \sa SDL_GetRenderDrawBlendMode()
   600  */
   601 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
   602                                                        SDL_BlendMode blendMode);
   603 
   604 /**
   605  *  \brief Get the blend mode used for drawing operations.
   606  *  
   607  *  \param renderer The renderer from which blend mode should be queried.
   608  *  \param blendMode A pointer filled in with the current blend mode.
   609  *  
   610  *  \return 0 on success, or -1 on error
   611  *  
   612  *  \sa SDL_SetRenderDrawBlendMode()
   613  */
   614 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
   615                                                        SDL_BlendMode *blendMode);
   616 
   617 /**
   618  *  \brief Clear the current rendering target with the drawing color
   619  *
   620  *  This function clears the entire rendering target, ignoring the viewport.
   621  *
   622  *  \return 0 on success, or -1 on error
   623  */
   624 extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
   625 
   626 /**
   627  *  \brief Draw a point on the current rendering target.
   628  *  
   629  *  \param renderer The renderer which should draw a point.
   630  *  \param x The x coordinate of the point.
   631  *  \param y The y coordinate of the point.
   632  *  
   633  *  \return 0 on success, or -1 on error
   634  */
   635 extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
   636                                                 int x, int y);
   637 
   638 /**
   639  *  \brief Draw multiple points on the current rendering target.
   640  *  
   641  *  \param renderer The renderer which should draw multiple points.
   642  *  \param points The points to draw
   643  *  \param count The number of points to draw
   644  *  
   645  *  \return 0 on success, or -1 on error
   646  */
   647 extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
   648                                                  const SDL_Point * points,
   649                                                  int count);
   650 
   651 /**
   652  *  \brief Draw a line on the current rendering target.
   653  *  
   654  *  \param renderer The renderer which should draw a line.
   655  *  \param x1 The x coordinate of the start point.
   656  *  \param y1 The y coordinate of the start point.
   657  *  \param x2 The x coordinate of the end point.
   658  *  \param y2 The y coordinate of the end point.
   659  *  
   660  *  \return 0 on success, or -1 on error
   661  */
   662 extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
   663                                                int x1, int y1, int x2, int y2);
   664 
   665 /**
   666  *  \brief Draw a series of connected lines on the current rendering target.
   667  *  
   668  *  \param renderer The renderer which should draw multiple lines.
   669  *  \param points The points along the lines
   670  *  \param count The number of points, drawing count-1 lines
   671  *  
   672  *  \return 0 on success, or -1 on error
   673  */
   674 extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
   675                                                 const SDL_Point * points,
   676                                                 int count);
   677 
   678 /**
   679  *  \brief Draw a rectangle on the current rendering target.
   680  *  
   681  *  \param renderer The renderer which should draw a rectangle.
   682  *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
   683  *  
   684  *  \return 0 on success, or -1 on error
   685  */
   686 extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
   687                                                const SDL_Rect * rect);
   688 
   689 /**
   690  *  \brief Draw some number of rectangles on the current rendering target.
   691  *  
   692  *  \param renderer The renderer which should draw multiple rectangles.
   693  *  \param rects A pointer to an array of destination rectangles.
   694  *  \param count The number of rectangles.
   695  *  
   696  *  \return 0 on success, or -1 on error
   697  */
   698 extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
   699                                                 const SDL_Rect * rects,
   700                                                 int count);
   701 
   702 /**
   703  *  \brief Fill a rectangle on the current rendering target with the drawing color.
   704  *  
   705  *  \param renderer The renderer which should fill a rectangle.
   706  *  \param rect A pointer to the destination rectangle, or NULL for the entire 
   707  *              rendering target.
   708  *  
   709  *  \return 0 on success, or -1 on error
   710  */
   711 extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
   712                                                const SDL_Rect * rect);
   713 
   714 /**
   715  *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
   716  *  
   717  *  \param renderer The renderer which should fill multiple rectangles.
   718  *  \param rects A pointer to an array of destination rectangles.
   719  *  \param count The number of rectangles.
   720  *  
   721  *  \return 0 on success, or -1 on error
   722  */
   723 extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
   724                                                 const SDL_Rect * rects,
   725                                                 int count);
   726 
   727 /**
   728  *  \brief Copy a portion of the texture to the current rendering target.
   729  *  
   730  *  \param renderer The renderer which should copy parts of a texture.
   731  *  \param texture The source texture.
   732  *  \param srcrect   A pointer to the source rectangle, or NULL for the entire 
   733  *                   texture.
   734  *  \param dstrect   A pointer to the destination rectangle, or NULL for the 
   735  *                   entire rendering target.
   736  *  
   737  *  \return 0 on success, or -1 on error
   738  */
   739 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
   740                                            SDL_Texture * texture,
   741                                            const SDL_Rect * srcrect,
   742                                            const SDL_Rect * dstrect);
   743 
   744 /**
   745  *  \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center 
   746  *
   747  *  \param renderer The renderer which should copy parts of a texture.
   748  *  \param texture The source texture.
   749  *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
   750  *                   texture.
   751  *  \param dstrect   A pointer to the destination rectangle, or NULL for the
   752  *                   entire rendering target.
   753  *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect
   754  *  \param center   A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
   755  *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
   756  * 
   757  *  \return 0 on success, or -1 on error
   758  */
   759 extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
   760                                            SDL_Texture * texture,
   761                                            const SDL_Rect * srcrect,
   762                                            const SDL_Rect * dstrect,
   763                                            const double angle,
   764                                            const SDL_Point *center,
   765                                            const SDL_RendererFlip flip);
   766 
   767 /**
   768  *  \brief Read pixels from the current rendering target.
   769  *  
   770  *  \param renderer The renderer from which pixels should be read.
   771  *  \param rect   A pointer to the rectangle to read, or NULL for the entire 
   772  *                render target.
   773  *  \param format The desired format of the pixel data, or 0 to use the format
   774  *                of the rendering target
   775  *  \param pixels A pointer to be filled in with the pixel data
   776  *  \param pitch  The pitch of the pixels parameter.
   777  *  
   778  *  \return 0 on success, or -1 if pixel reading is not supported.
   779  *  
   780  *  \warning This is a very slow operation, and should not be used frequently.
   781  */
   782 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
   783                                                  const SDL_Rect * rect,
   784                                                  Uint32 format,
   785                                                  void *pixels, int pitch);
   786 
   787 /**
   788  *  \brief Update the screen with rendering performed.
   789  */
   790 extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
   791 
   792 /**
   793  *  \brief Destroy the specified texture.
   794  *  
   795  *  \sa SDL_CreateTexture()
   796  *  \sa SDL_CreateTextureFromSurface()
   797  */
   798 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
   799 
   800 /**
   801  *  \brief Destroy the rendering context for a window and free associated
   802  *         textures.
   803  *  
   804  *  \sa SDL_CreateRenderer()
   805  */
   806 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
   807 
   808 
   809 /**
   810  *  \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
   811  *         OpenGL instructions.
   812  *
   813  *  \param texture  The SDL texture to bind
   814  *  \param texw     A pointer to a float that will be filled with the texture width
   815  *  \param texh     A pointer to a float that will be filled with the texture height
   816  *
   817  *  \return 0 on success, or -1 if the operation is not supported
   818  */
   819 extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
   820 
   821 /**
   822  *  \brief Unbind a texture from the current OpenGL/ES/ES2 context.
   823  *
   824  *  \param texture  The SDL texture to unbind
   825  *
   826  *  \return 0 on success, or -1 if the operation is not supported
   827  */
   828 extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
   829 
   830 
   831 /* Ends C function definitions when using C++ */
   832 #ifdef __cplusplus
   833 /* *INDENT-OFF* */
   834 }
   835 /* *INDENT-ON* */
   836 #endif
   837 #include "close_code.h"
   838 
   839 #endif /* _SDL_render_h */
   840 
   841 /* vi: set ts=4 sw=4 expandtab: */