include/SDL_render.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 10 Aug 2017 11:57:19 -0700
changeset 11216 908e4fe53f5a
parent 10737 3406a0f8b041
child 11224 aca84e42a924
permissions -rw-r--r--
Fixed bug 3681 - SDL_UpateTexture documentation not specific enough about format requirement

Simon Hug

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