include/SDL_render.h
author Ryan C. Gordon <icculus@icculus.org>
Mon, 14 Jan 2019 19:43:25 -0500
changeset 12548 1ae839748d02
parent 12503 806492103856
permissions -rw-r--r--
evdev: don't debug log on a BTN_TOUCH from a non-touch device.
slouken@5145
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@12503
     3
  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
slouken@5145
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@5145
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@5145
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@5145
    20
*/
slouken@5145
    21
slouken@5145
    22
/**
slouken@5145
    23
 *  \file SDL_render.h
slouken@7191
    24
 *
slouken@5145
    25
 *  Header file for SDL 2D rendering functions.
slouken@5164
    26
 *
slouken@5164
    27
 *  This API supports the following features:
slouken@5164
    28
 *      * single pixel points
slouken@5164
    29
 *      * single pixel lines
slouken@5164
    30
 *      * filled rectangles
slouken@5164
    31
 *      * texture images
slouken@5164
    32
 *
slouken@5164
    33
 *  The primitives may be drawn in opaque, blended, or additive modes.
slouken@5164
    34
 *
slouken@5164
    35
 *  The texture images may be drawn in opaque, blended, or additive modes.
slouken@5164
    36
 *  They can have an additional color tint or alpha modulation applied to
slouken@5164
    37
 *  them, and may also be stretched with linear interpolation.
slouken@5164
    38
 *
slouken@5164
    39
 *  This API is designed to accelerate simple 2D operations. You may
slouken@7542
    40
 *  want more functionality such as polygons and particle effects and
slouken@5164
    41
 *  in that case you should use SDL's OpenGL/Direct3D support or one
slouken@5164
    42
 *  of the many good 3D engines.
slouken@7542
    43
 *
slouken@7542
    44
 *  These functions must be called from the main thread.
slouken@7542
    45
 *  See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
slouken@5145
    46
 */
slouken@5145
    47
slouken@10638
    48
#ifndef SDL_render_h_
slouken@10638
    49
#define SDL_render_h_
slouken@5145
    50
slouken@5145
    51
#include "SDL_stdinc.h"
slouken@5145
    52
#include "SDL_rect.h"
slouken@5145
    53
#include "SDL_video.h"
slouken@5145
    54
slouken@5145
    55
#include "begin_code.h"
slouken@5145
    56
/* Set up for C function definitions, even when using C++ */
slouken@5145
    57
#ifdef __cplusplus
slouken@5145
    58
extern "C" {
slouken@5145
    59
#endif
slouken@5145
    60
slouken@5145
    61
/**
slouken@5145
    62
 *  \brief Flags used when creating a rendering context
slouken@5145
    63
 */
slouken@5145
    64
typedef enum
slouken@5145
    65
{
slouken@7191
    66
    SDL_RENDERER_SOFTWARE = 0x00000001,         /**< The renderer is a software fallback */
slouken@7191
    67
    SDL_RENDERER_ACCELERATED = 0x00000002,      /**< The renderer uses hardware
slouken@5145
    68
                                                     acceleration */
slouken@7191
    69
    SDL_RENDERER_PRESENTVSYNC = 0x00000004,     /**< Present is synchronized
slouken@5145
    70
                                                     with the refresh rate */
slouken@6237
    71
    SDL_RENDERER_TARGETTEXTURE = 0x00000008     /**< The renderer supports
slouken@6237
    72
                                                     rendering to texture */
slouken@5145
    73
} SDL_RendererFlags;
slouken@5145
    74
slouken@5145
    75
/**
slouken@5145
    76
 *  \brief Information on the capabilities of a render driver or context.
slouken@5145
    77
 */
slouken@5145
    78
typedef struct SDL_RendererInfo
slouken@5145
    79
{
slouken@5145
    80
    const char *name;           /**< The name of the renderer */
slouken@5145
    81
    Uint32 flags;               /**< Supported ::SDL_RendererFlags */
slouken@5145
    82
    Uint32 num_texture_formats; /**< The number of available texture formats */
slouken@5156
    83
    Uint32 texture_formats[16]; /**< The available texture formats */
philipp@9323
    84
    int max_texture_width;      /**< The maximum texture width */
philipp@9323
    85
    int max_texture_height;     /**< The maximum texture height */
slouken@5145
    86
} SDL_RendererInfo;
slouken@5145
    87
slouken@5145
    88
/**
slouken@5145
    89
 *  \brief The access pattern allowed for a texture.
slouken@5145
    90
 */
slouken@5145
    91
typedef enum
slouken@5145
    92
{
slouken@5145
    93
    SDL_TEXTUREACCESS_STATIC,    /**< Changes rarely, not lockable */
slouken@6232
    94
    SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
slouken@6232
    95
    SDL_TEXTUREACCESS_TARGET     /**< Texture can be used as a render target */
slouken@5145
    96
} SDL_TextureAccess;
slouken@5145
    97
slouken@5145
    98
/**
slouken@5145
    99
 *  \brief The texture channel modulation used in SDL_RenderCopy().
slouken@5145
   100
 */
slouken@5145
   101
typedef enum
slouken@5145
   102
{
slouken@5145
   103
    SDL_TEXTUREMODULATE_NONE = 0x00000000,     /**< No modulation */
slouken@5145
   104
    SDL_TEXTUREMODULATE_COLOR = 0x00000001,    /**< srcC = srcC * color */
slouken@5145
   105
    SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
slouken@5145
   106
} SDL_TextureModulate;
slouken@5145
   107
slouken@5145
   108
/**
gabomdq@6320
   109
 *  \brief Flip constants for SDL_RenderCopyEx
gabomdq@6320
   110
 */
gabomdq@6320
   111
typedef enum
gabomdq@6320
   112
{
gabomdq@6320
   113
    SDL_FLIP_NONE = 0x00000000,     /**< Do not flip */
gabomdq@6320
   114
    SDL_FLIP_HORIZONTAL = 0x00000001,    /**< flip horizontally */
gabomdq@6320
   115
    SDL_FLIP_VERTICAL = 0x00000002     /**< flip vertically */
gabomdq@6320
   116
} SDL_RendererFlip;
gabomdq@6320
   117
gabomdq@6320
   118
/**
slouken@5147
   119
 *  \brief A structure representing rendering state
slouken@5147
   120
 */
slouken@5147
   121
struct SDL_Renderer;
slouken@5147
   122
typedef struct SDL_Renderer SDL_Renderer;
slouken@5147
   123
slouken@5147
   124
/**
slouken@5145
   125
 *  \brief An efficient driver-specific representation of pixel data
slouken@5145
   126
 */
slouken@5145
   127
struct SDL_Texture;
slouken@5145
   128
typedef struct SDL_Texture SDL_Texture;
slouken@5145
   129
slouken@5145
   130
slouken@5145
   131
/* Function prototypes */
slouken@5145
   132
slouken@5145
   133
/**
slouken@7191
   134
 *  \brief Get the number of 2D rendering drivers available for the current
slouken@5145
   135
 *         display.
slouken@7191
   136
 *
slouken@5145
   137
 *  A render driver is a set of code that handles rendering and texture
slouken@5145
   138
 *  management on a particular display.  Normally there is only one, but
slouken@5145
   139
 *  some drivers may have several available with different capabilities.
slouken@7191
   140
 *
slouken@5145
   141
 *  \sa SDL_GetRenderDriverInfo()
slouken@5145
   142
 *  \sa SDL_CreateRenderer()
slouken@5145
   143
 */
slouken@5145
   144
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
slouken@5145
   145
slouken@5145
   146
/**
slouken@7191
   147
 *  \brief Get information about a specific 2D rendering driver for the current
slouken@5145
   148
 *         display.
slouken@7191
   149
 *
slouken@5145
   150
 *  \param index The index of the driver to query information about.
slouken@7191
   151
 *  \param info  A pointer to an SDL_RendererInfo struct to be filled with
slouken@5145
   152
 *               information on the rendering driver.
slouken@7191
   153
 *
slouken@5145
   154
 *  \return 0 on success, -1 if the index was out of range.
slouken@7191
   155
 *
slouken@5145
   156
 *  \sa SDL_CreateRenderer()
slouken@5145
   157
 */
slouken@5145
   158
extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
slouken@5145
   159
                                                    SDL_RendererInfo * info);
slouken@5145
   160
slouken@5145
   161
/**
slouken@6258
   162
 *  \brief Create a window and default renderer
slouken@6258
   163
 *
slouken@6258
   164
 *  \param width    The width of the window
slouken@6258
   165
 *  \param height   The height of the window
slouken@6258
   166
 *  \param window_flags The flags used to create the window
slouken@6258
   167
 *  \param window   A pointer filled with the window, or NULL on error
slouken@6258
   168
 *  \param renderer A pointer filled with the renderer, or NULL on error
slouken@6258
   169
 *
slouken@6258
   170
 *  \return 0 on success, or -1 on error
slouken@6258
   171
 */
slouken@6258
   172
extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
slouken@6258
   173
                                int width, int height, Uint32 window_flags,
slouken@6258
   174
                                SDL_Window **window, SDL_Renderer **renderer);
slouken@6258
   175
slouken@6258
   176
slouken@6258
   177
/**
slouken@5147
   178
 *  \brief Create a 2D rendering context for a window.
slouken@7191
   179
 *
slouken@5145
   180
 *  \param window The window where rendering is displayed.
slouken@7191
   181
 *  \param index    The index of the rendering driver to initialize, or -1 to
slouken@5145
   182
 *                  initialize the first one supporting the requested flags.
slouken@5145
   183
 *  \param flags    ::SDL_RendererFlags.
slouken@7191
   184
 *
slouken@5147
   185
 *  \return A valid rendering context or NULL if there was an error.
slouken@7191
   186
 *
slouken@5166
   187
 *  \sa SDL_CreateSoftwareRenderer()
slouken@5145
   188
 *  \sa SDL_GetRendererInfo()
slouken@5145
   189
 *  \sa SDL_DestroyRenderer()
slouken@5145
   190
 */
slouken@5147
   191
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
slouken@5145
   192
                                               int index, Uint32 flags);
slouken@5145
   193
slouken@5145
   194
/**
slouken@5166
   195
 *  \brief Create a 2D software rendering context for a surface.
slouken@7191
   196
 *
slouken@5166
   197
 *  \param surface The surface where rendering is done.
slouken@7191
   198
 *
slouken@5166
   199
 *  \return A valid rendering context or NULL if there was an error.
slouken@7191
   200
 *
slouken@5166
   201
 *  \sa SDL_CreateRenderer()
slouken@5166
   202
 *  \sa SDL_DestroyRenderer()
slouken@5166
   203
 */
slouken@5166
   204
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
slouken@5166
   205
slouken@5166
   206
/**
slouken@5528
   207
 *  \brief Get the renderer associated with a window.
slouken@5528
   208
 */
slouken@5528
   209
extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
slouken@5528
   210
slouken@5528
   211
/**
slouken@5147
   212
 *  \brief Get information about a rendering context.
slouken@5145
   213
 */
slouken@5147
   214
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
slouken@5147
   215
                                                SDL_RendererInfo * info);
slouken@5145
   216
slouken@5145
   217
/**
slime73@9995
   218
 *  \brief Get the output size in pixels of a rendering context.
slouken@7239
   219
 */
slouken@7239
   220
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
slouken@7239
   221
                                                      int *w, int *h);
slouken@7239
   222
slouken@7239
   223
/**
slouken@5147
   224
 *  \brief Create a texture for a rendering context.
slouken@7191
   225
 *
philipp@7188
   226
 *  \param renderer The renderer.
slouken@5145
   227
 *  \param format The format of the texture.
slouken@5145
   228
 *  \param access One of the enumerated values in ::SDL_TextureAccess.
slouken@5145
   229
 *  \param w      The width of the texture in pixels.
slouken@5145
   230
 *  \param h      The height of the texture in pixels.
slouken@7191
   231
 *
philipp@9850
   232
 *  \return The created texture is returned, or NULL if no rendering context was
slouken@5145
   233
 *          active,  the format was unsupported, or the width or height were out
slouken@5145
   234
 *          of range.
slouken@7191
   235
 *
slouken@11244
   236
 *  \note The contents of the texture are not defined at creation.
slouken@11244
   237
 *
slouken@5145
   238
 *  \sa SDL_QueryTexture()
slouken@5216
   239
 *  \sa SDL_UpdateTexture()
slouken@5145
   240
 *  \sa SDL_DestroyTexture()
slouken@5145
   241
 */
slouken@5344
   242
extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
slouken@5344
   243
                                                        Uint32 format,
slouken@5145
   244
                                                        int access, int w,
slouken@5145
   245
                                                        int h);
slouken@5145
   246
slouken@5145
   247
/**
slouken@5145
   248
 *  \brief Create a texture from an existing surface.
slouken@7191
   249
 *
philipp@7188
   250
 *  \param renderer The renderer.
slouken@5145
   251
 *  \param surface The surface containing pixel data used to fill the texture.
slouken@7191
   252
 *
philipp@9850
   253
 *  \return The created texture is returned, or NULL on error.
slouken@7191
   254
 *
slouken@5145
   255
 *  \note The surface is not modified or freed by this function.
slouken@7191
   256
 *
slouken@5145
   257
 *  \sa SDL_QueryTexture()
slouken@5145
   258
 *  \sa SDL_DestroyTexture()
slouken@5145
   259
 */
slouken@5158
   260
extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
slouken@5145
   261
slouken@5145
   262
/**
slouken@5145
   263
 *  \brief Query the attributes of a texture
slouken@7191
   264
 *
slouken@5145
   265
 *  \param texture A texture to be queried.
slouken@7191
   266
 *  \param format  A pointer filled in with the raw format of the texture.  The
slouken@7191
   267
 *                 actual format may differ, but pixel transfers will use this
slouken@5145
   268
 *                 format.
slouken@5145
   269
 *  \param access  A pointer filled in with the actual access to the texture.
slouken@5145
   270
 *  \param w       A pointer filled in with the width of the texture in pixels.
slouken@5145
   271
 *  \param h       A pointer filled in with the height of the texture in pixels.
slouken@7191
   272
 *
slouken@5145
   273
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@5145
   274
 */
slouken@5145
   275
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
slouken@5145
   276
                                             Uint32 * format, int *access,
slouken@5145
   277
                                             int *w, int *h);
slouken@5145
   278
slouken@5145
   279
/**
slouken@5145
   280
 *  \brief Set an additional color value used in render copy operations.
slouken@7191
   281
 *
slouken@5145
   282
 *  \param texture The texture to update.
slouken@5145
   283
 *  \param r       The red color value multiplied into copy operations.
slouken@5145
   284
 *  \param g       The green color value multiplied into copy operations.
slouken@5145
   285
 *  \param b       The blue color value multiplied into copy operations.
slouken@7191
   286
 *
slouken@7191
   287
 *  \return 0 on success, or -1 if the texture is not valid or color modulation
slouken@5145
   288
 *          is not supported.
slouken@7191
   289
 *
slouken@5145
   290
 *  \sa SDL_GetTextureColorMod()
slouken@5145
   291
 */
slouken@5145
   292
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
slouken@5145
   293
                                                   Uint8 r, Uint8 g, Uint8 b);
slouken@5145
   294
slouken@5145
   295
slouken@5145
   296
/**
slouken@5145
   297
 *  \brief Get the additional color value used in render copy operations.
slouken@7191
   298
 *
slouken@5145
   299
 *  \param texture The texture to query.
slouken@5145
   300
 *  \param r         A pointer filled in with the current red color value.
slouken@5145
   301
 *  \param g         A pointer filled in with the current green color value.
slouken@5145
   302
 *  \param b         A pointer filled in with the current blue color value.
slouken@7191
   303
 *
slouken@5145
   304
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@7191
   305
 *
slouken@5145
   306
 *  \sa SDL_SetTextureColorMod()
slouken@5145
   307
 */
slouken@5145
   308
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
slouken@5145
   309
                                                   Uint8 * r, Uint8 * g,
slouken@5145
   310
                                                   Uint8 * b);
slouken@5145
   311
slouken@5145
   312
/**
slouken@5145
   313
 *  \brief Set an additional alpha value used in render copy operations.
slouken@7191
   314
 *
slouken@5145
   315
 *  \param texture The texture to update.
slouken@5145
   316
 *  \param alpha     The alpha value multiplied into copy operations.
slouken@7191
   317
 *
slouken@7191
   318
 *  \return 0 on success, or -1 if the texture is not valid or alpha modulation
slouken@5145
   319
 *          is not supported.
slouken@7191
   320
 *
slouken@5145
   321
 *  \sa SDL_GetTextureAlphaMod()
slouken@5145
   322
 */
slouken@5145
   323
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
slouken@5145
   324
                                                   Uint8 alpha);
slouken@5145
   325
slouken@5145
   326
/**
slouken@5145
   327
 *  \brief Get the additional alpha value used in render copy operations.
slouken@7191
   328
 *
slouken@5145
   329
 *  \param texture The texture to query.
slouken@5145
   330
 *  \param alpha     A pointer filled in with the current alpha value.
slouken@7191
   331
 *
slouken@5145
   332
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@7191
   333
 *
slouken@5145
   334
 *  \sa SDL_SetTextureAlphaMod()
slouken@5145
   335
 */
slouken@5145
   336
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
slouken@5145
   337
                                                   Uint8 * alpha);
slouken@5145
   338
slouken@5145
   339
/**
slouken@5145
   340
 *  \brief Set the blend mode used for texture copy operations.
slouken@7191
   341
 *
slouken@5145
   342
 *  \param texture The texture to update.
slouken@5145
   343
 *  \param blendMode ::SDL_BlendMode to use for texture blending.
slouken@7191
   344
 *
slouken@5145
   345
 *  \return 0 on success, or -1 if the texture is not valid or the blend mode is
slouken@5145
   346
 *          not supported.
slouken@7191
   347
 *
slouken@5145
   348
 *  \note If the blend mode is not supported, the closest supported mode is
slouken@5145
   349
 *        chosen.
slouken@7191
   350
 *
slouken@5145
   351
 *  \sa SDL_GetTextureBlendMode()
slouken@5145
   352
 */
slouken@5145
   353
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
slouken@5145
   354
                                                    SDL_BlendMode blendMode);
slouken@5145
   355
slouken@5145
   356
/**
slouken@5145
   357
 *  \brief Get the blend mode used for texture copy operations.
slouken@7191
   358
 *
slouken@5156
   359
 *  \param texture   The texture to query.
slouken@5145
   360
 *  \param blendMode A pointer filled in with the current blend mode.
slouken@7191
   361
 *
slouken@5145
   362
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@7191
   363
 *
slouken@5145
   364
 *  \sa SDL_SetTextureBlendMode()
slouken@5145
   365
 */
slouken@5145
   366
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
slouken@5145
   367
                                                    SDL_BlendMode *blendMode);
slouken@5145
   368
slouken@5145
   369
/**
slouken@5145
   370
 *  \brief Update the given texture rectangle with new pixel data.
slouken@7191
   371
 *
slouken@5156
   372
 *  \param texture   The texture to update
slouken@7191
   373
 *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
slouken@5145
   374
 *                   update the entire texture.
slouken@11216
   375
 *  \param pixels    The raw pixel data in the format of the texture.
slouken@9248
   376
 *  \param pitch     The number of bytes in a row of pixel data, including padding between lines.
slouken@7191
   377
 *
slouken@11216
   378
 *  The pixel data must be in the format of the texture. The pixel format can be
slouken@11216
   379
 *  queried with SDL_QueryTexture.
slouken@11216
   380
 *
slouken@5145
   381
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@7191
   382
 *
slouken@5145
   383
 *  \note This is a fairly slow function.
slouken@5145
   384
 */
slouken@5145
   385
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
slouken@5145
   386
                                              const SDL_Rect * rect,
slouken@5145
   387
                                              const void *pixels, int pitch);
slouken@5145
   388
slouken@5145
   389
/**
slouken@7759
   390
 *  \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
slouken@7759
   391
 *
slouken@7759
   392
 *  \param texture   The texture to update
slouken@7759
   393
 *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
slouken@7759
   394
 *                   update the entire texture.
slouken@7759
   395
 *  \param Yplane    The raw pixel data for the Y plane.
slouken@7759
   396
 *  \param Ypitch    The number of bytes between rows of pixel data for the Y plane.
slouken@7759
   397
 *  \param Uplane    The raw pixel data for the U plane.
slouken@7759
   398
 *  \param Upitch    The number of bytes between rows of pixel data for the U plane.
slouken@7759
   399
 *  \param Vplane    The raw pixel data for the V plane.
slouken@7759
   400
 *  \param Vpitch    The number of bytes between rows of pixel data for the V plane.
slouken@7759
   401
 *
slouken@7759
   402
 *  \return 0 on success, or -1 if the texture is not valid.
slouken@7759
   403
 *
slouken@7759
   404
 *  \note You can use SDL_UpdateTexture() as long as your pixel data is
slouken@7759
   405
 *        a contiguous block of Y and U/V planes in the proper order, but
slouken@7759
   406
 *        this function is available if your pixel data is not contiguous.
slouken@7759
   407
 */
slouken@7759
   408
extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
slouken@7759
   409
                                                 const SDL_Rect * rect,
slouken@7759
   410
                                                 const Uint8 *Yplane, int Ypitch,
slouken@7759
   411
                                                 const Uint8 *Uplane, int Upitch,
slouken@7759
   412
                                                 const Uint8 *Vplane, int Vpitch);
slouken@7759
   413
slouken@7759
   414
/**
slouken@6493
   415
 *  \brief Lock a portion of the texture for write-only pixel access.
slouken@7191
   416
 *
slouken@7191
   417
 *  \param texture   The texture to lock for access, which was created with
slouken@5145
   418
 *                   ::SDL_TEXTUREACCESS_STREAMING.
slouken@7191
   419
 *  \param rect      A pointer to the rectangle to lock for access. If the rect
slouken@5145
   420
 *                   is NULL, the entire texture will be locked.
slouken@7191
   421
 *  \param pixels    This is filled in with a pointer to the locked pixels,
slouken@5145
   422
 *                   appropriately offset by the locked area.
slouken@5145
   423
 *  \param pitch     This is filled in with the pitch of the locked pixels.
slouken@7191
   424
 *
slouken@5156
   425
 *  \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
slouken@7191
   426
 *
slouken@5145
   427
 *  \sa SDL_UnlockTexture()
slouken@5145
   428
 */
slouken@5145
   429
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
slouken@5145
   430
                                            const SDL_Rect * rect,
slouken@5156
   431
                                            void **pixels, int *pitch);
slouken@5145
   432
slouken@5145
   433
/**
slouken@5156
   434
 *  \brief Unlock a texture, uploading the changes to video memory, if needed.
slouken@7191
   435
 *
slouken@5145
   436
 *  \sa SDL_LockTexture()
slouken@5145
   437
 */
slouken@5145
   438
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
slouken@5145
   439
slouken@5145
   440
/**
slouken@6247
   441
 * \brief Determines whether a window supports the use of render targets
slouken@6247
   442
 *
slouken@6247
   443
 * \param renderer The renderer that will be checked
slouken@6247
   444
 *
slouken@6247
   445
 * \return SDL_TRUE if supported, SDL_FALSE if not.
slouken@6247
   446
 */
slouken@6247
   447
extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
slouken@6247
   448
slouken@6247
   449
/**
slouken@6247
   450
 * \brief Set a texture as the current rendering target.
slouken@6247
   451
 *
philipp@7188
   452
 * \param renderer The renderer.
slouken@6248
   453
 * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
slouken@6247
   454
 *
slouken@6247
   455
 * \return 0 on success, or -1 on error
slouken@6578
   456
 *
slouken@6578
   457
 *  \sa SDL_GetRenderTarget()
slouken@6247
   458
 */
slouken@6247
   459
extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
slouken@6247
   460
                                                SDL_Texture *texture);
slouken@6247
   461
slouken@6247
   462
/**
slouken@6578
   463
 * \brief Get the current render target or NULL for the default render target.
slouken@6578
   464
 *
slouken@6578
   465
 * \return The current render target
slouken@6578
   466
 *
slouken@6578
   467
 *  \sa SDL_SetRenderTarget()
slouken@6578
   468
 */
slouken@6578
   469
extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
slouken@6578
   470
slouken@6578
   471
/**
slouken@6530
   472
 *  \brief Set device independent resolution for rendering
slouken@6530
   473
 *
philipp@7188
   474
 *  \param renderer The renderer for which resolution should be set.
slouken@6530
   475
 *  \param w      The width of the logical resolution
slouken@6530
   476
 *  \param h      The height of the logical resolution
slouken@6530
   477
 *
slouken@6530
   478
 *  This function uses the viewport and scaling functionality to allow a fixed logical
slouken@6530
   479
 *  resolution for rendering, regardless of the actual output resolution.  If the actual
slouken@6530
   480
 *  output resolution doesn't have the same aspect ratio the output rendering will be
slouken@6530
   481
 *  centered within the output display.
slouken@6530
   482
 *
slouken@6530
   483
 *  If the output display is a window, mouse events in the window will be filtered
slouken@6530
   484
 *  and scaled so they seem to arrive within the logical resolution.
slouken@6530
   485
 *
slouken@7191
   486
 *  \note If this function results in scaling or subpixel drawing by the
slouken@6530
   487
 *        rendering backend, it will be handled using the appropriate
slouken@6530
   488
 *        quality hints.
slouken@6530
   489
 *
slouken@6530
   490
 *  \sa SDL_RenderGetLogicalSize()
slouken@6530
   491
 *  \sa SDL_RenderSetScale()
slouken@6530
   492
 *  \sa SDL_RenderSetViewport()
slouken@6530
   493
 */
slouken@6530
   494
extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
slouken@6530
   495
slouken@6530
   496
/**
slouken@6530
   497
 *  \brief Get device independent resolution for rendering
slouken@6530
   498
 *
philipp@7188
   499
 *  \param renderer The renderer from which resolution should be queried.
slouken@6530
   500
 *  \param w      A pointer filled with the width of the logical resolution
slouken@6530
   501
 *  \param h      A pointer filled with the height of the logical resolution
slouken@6530
   502
 *
slouken@6530
   503
 *  \sa SDL_RenderSetLogicalSize()
slouken@6530
   504
 */
philipp@7175
   505
extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
slouken@6530
   506
slouken@6530
   507
/**
flibitijibibo@10039
   508
 *  \brief Set whether to force integer scales for resolution-independent rendering
flibitijibibo@10039
   509
 *
flibitijibibo@10039
   510
 *  \param renderer The renderer for which integer scaling should be set.
flibitijibibo@10039
   511
 *  \param enable   Enable or disable integer scaling
flibitijibibo@10039
   512
 *
flibitijibibo@10039
   513
 *  This function restricts the logical viewport to integer values - that is, when
flibitijibibo@10039
   514
 *  a resolution is between two multiples of a logical size, the viewport size is
flibitijibibo@10039
   515
 *  rounded down to the lower multiple.
flibitijibibo@10039
   516
 *
flibitijibibo@10039
   517
 *  \sa SDL_RenderSetLogicalSize()
flibitijibibo@10039
   518
 */
flibitijibibo@10039
   519
extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
flibitijibibo@10039
   520
                                                      SDL_bool enable);
flibitijibibo@10039
   521
flibitijibibo@10039
   522
/**
flibitijibibo@10039
   523
 *  \brief Get whether integer scales are forced for resolution-independent rendering
flibitijibibo@10039
   524
 *
flibitijibibo@10039
   525
 *  \param renderer The renderer from which integer scaling should be queried.
flibitijibibo@10039
   526
 *
flibitijibibo@10039
   527
 *  \sa SDL_RenderSetIntegerScale()
flibitijibibo@10039
   528
 */
flibitijibibo@10039
   529
extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
flibitijibibo@10039
   530
flibitijibibo@10039
   531
/**
slouken@5297
   532
 *  \brief Set the drawing area for rendering on the current target.
slouken@5224
   533
 *
philipp@7188
   534
 *  \param renderer The renderer for which the drawing area should be set.
slouken@5297
   535
 *  \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
slouken@5224
   536
 *
slouken@5297
   537
 *  The x,y of the viewport rect represents the origin for rendering.
slouken@5297
   538
 *
slouken@7141
   539
 *  \return 0 on success, or -1 on error
slouken@7141
   540
 *
slouken@7240
   541
 *  \note If the window associated with the renderer is resized, the viewport is automatically reset.
slouken@6530
   542
 *
slouken@6530
   543
 *  \sa SDL_RenderGetViewport()
slouken@6530
   544
 *  \sa SDL_RenderSetLogicalSize()
slouken@5224
   545
 */
slouken@5297
   546
extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
slouken@5297
   547
                                                  const SDL_Rect * rect);
slouken@5297
   548
slouken@5297
   549
/**
slouken@5297
   550
 *  \brief Get the drawing area for the current target.
slouken@6530
   551
 *
slouken@6530
   552
 *  \sa SDL_RenderSetViewport()
slouken@5297
   553
 */
slouken@5297
   554
extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
slouken@5297
   555
                                                   SDL_Rect * rect);
slouken@5224
   556
slouken@5224
   557
/**
slouken@7141
   558
 *  \brief Set the clip rectangle for the current target.
slouken@7191
   559
 *
philipp@7188
   560
 *  \param renderer The renderer for which clip rectangle should be set.
slouken@7141
   561
 *  \param rect   A pointer to the rectangle to set as the clip rectangle, or
slouken@7141
   562
 *                NULL to disable clipping.
slouken@7141
   563
 *
slouken@7141
   564
 *  \return 0 on success, or -1 on error
slouken@7141
   565
 *
slouken@7141
   566
 *  \sa SDL_RenderGetClipRect()
slouken@7141
   567
 */
slouken@7141
   568
extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
slouken@7141
   569
                                                  const SDL_Rect * rect);
slouken@7141
   570
slouken@7141
   571
/**
slouken@7141
   572
 *  \brief Get the clip rectangle for the current target.
slouken@7191
   573
 *
philipp@7188
   574
 *  \param renderer The renderer from which clip rectangle should be queried.
slouken@7141
   575
 *  \param rect   A pointer filled in with the current clip rectangle, or
slouken@7141
   576
 *                an empty rectangle if clipping is disabled.
slouken@7141
   577
 *
slouken@7141
   578
 *  \sa SDL_RenderSetClipRect()
slouken@7141
   579
 */
slouken@7141
   580
extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
slouken@7141
   581
                                                   SDL_Rect * rect);
slouken@7141
   582
slouken@7141
   583
/**
philipp@9199
   584
 *  \brief Get whether clipping is enabled on the given renderer.
jorgenpt@8728
   585
 *
jorgenpt@8728
   586
 *  \param renderer The renderer from which clip state should be queried.
jorgenpt@8728
   587
 *
jorgenpt@8728
   588
 *  \sa SDL_RenderGetClipRect()
jorgenpt@8728
   589
 */
jorgenpt@8728
   590
extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
jorgenpt@8728
   591
jorgenpt@8728
   592
jorgenpt@8728
   593
/**
slouken@6528
   594
 *  \brief Set the drawing scale for rendering on the current target.
slouken@6528
   595
 *
philipp@7188
   596
 *  \param renderer The renderer for which the drawing scale should be set.
slouken@6528
   597
 *  \param scaleX The horizontal scaling factor
slouken@6528
   598
 *  \param scaleY The vertical scaling factor
slouken@6528
   599
 *
slouken@6528
   600
 *  The drawing coordinates are scaled by the x/y scaling factors
slouken@6528
   601
 *  before they are used by the renderer.  This allows resolution
slouken@6528
   602
 *  independent drawing with a single coordinate system.
slouken@6528
   603
 *
slouken@7191
   604
 *  \note If this results in scaling or subpixel drawing by the
slouken@6528
   605
 *        rendering backend, it will be handled using the appropriate
slouken@6528
   606
 *        quality hints.  For best results use integer scaling factors.
slouken@6530
   607
 *
slouken@6530
   608
 *  \sa SDL_RenderGetScale()
slouken@6530
   609
 *  \sa SDL_RenderSetLogicalSize()
slouken@6528
   610
 */
slouken@6528
   611
extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
slouken@6528
   612
                                               float scaleX, float scaleY);
slouken@6528
   613
slouken@6528
   614
/**
slouken@6528
   615
 *  \brief Get the drawing scale for the current target.
slouken@6528
   616
 *
philipp@7188
   617
 *  \param renderer The renderer from which drawing scale should be queried.
slouken@6528
   618
 *  \param scaleX A pointer filled in with the horizontal scaling factor
slouken@6528
   619
 *  \param scaleY A pointer filled in with the vertical scaling factor
slouken@6530
   620
 *
slouken@6530
   621
 *  \sa SDL_RenderSetScale()
slouken@6528
   622
 */
slouken@6528
   623
extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
slouken@6528
   624
                                               float *scaleX, float *scaleY);
slouken@6528
   625
slouken@6528
   626
/**
slouken@6039
   627
 *  \brief Set the color used for drawing operations (Rect, Line and Clear).
slouken@7191
   628
 *
philipp@7188
   629
 *  \param renderer The renderer for which drawing color should be set.
slouken@5145
   630
 *  \param r The red value used to draw on the rendering target.
slouken@5145
   631
 *  \param g The green value used to draw on the rendering target.
slouken@5145
   632
 *  \param b The blue value used to draw on the rendering target.
slouken@7191
   633
 *  \param a The alpha value used to draw on the rendering target, usually
slouken@5145
   634
 *           ::SDL_ALPHA_OPAQUE (255).
slouken@7191
   635
 *
slouken@5147
   636
 *  \return 0 on success, or -1 on error
slouken@5145
   637
 */
icculus@8028
   638
extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
slouken@5147
   639
                                           Uint8 r, Uint8 g, Uint8 b,
slouken@5145
   640
                                           Uint8 a);
slouken@5145
   641
slouken@5145
   642
/**
slouken@6039
   643
 *  \brief Get the color used for drawing operations (Rect, Line and Clear).
slouken@7191
   644
 *
philipp@7188
   645
 *  \param renderer The renderer from which drawing color should be queried.
slouken@5145
   646
 *  \param r A pointer to the red value used to draw on the rendering target.
slouken@5145
   647
 *  \param g A pointer to the green value used to draw on the rendering target.
slouken@5145
   648
 *  \param b A pointer to the blue value used to draw on the rendering target.
slouken@7191
   649
 *  \param a A pointer to the alpha value used to draw on the rendering target,
slouken@5145
   650
 *           usually ::SDL_ALPHA_OPAQUE (255).
slouken@7191
   651
 *
slouken@5147
   652
 *  \return 0 on success, or -1 on error
slouken@5145
   653
 */
icculus@8028
   654
extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
slouken@5147
   655
                                           Uint8 * r, Uint8 * g, Uint8 * b,
slouken@5145
   656
                                           Uint8 * a);
slouken@5145
   657
slouken@5145
   658
/**
slouken@5145
   659
 *  \brief Set the blend mode used for drawing operations (Fill and Line).
slouken@7191
   660
 *
philipp@7188
   661
 *  \param renderer The renderer for which blend mode should be set.
slouken@5145
   662
 *  \param blendMode ::SDL_BlendMode to use for blending.
slouken@7191
   663
 *
slouken@5147
   664
 *  \return 0 on success, or -1 on error
slouken@7191
   665
 *
slouken@7191
   666
 *  \note If the blend mode is not supported, the closest supported mode is
slouken@5145
   667
 *        chosen.
slouken@7191
   668
 *
slouken@5145
   669
 *  \sa SDL_GetRenderDrawBlendMode()
slouken@5145
   670
 */
slouken@5147
   671
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
slouken@5147
   672
                                                       SDL_BlendMode blendMode);
slouken@5145
   673
slouken@5145
   674
/**
slouken@5145
   675
 *  \brief Get the blend mode used for drawing operations.
slouken@7191
   676
 *
philipp@7188
   677
 *  \param renderer The renderer from which blend mode should be queried.
slouken@5145
   678
 *  \param blendMode A pointer filled in with the current blend mode.
slouken@7191
   679
 *
slouken@5147
   680
 *  \return 0 on success, or -1 on error
slouken@7191
   681
 *
slouken@5145
   682
 *  \sa SDL_SetRenderDrawBlendMode()
slouken@5145
   683
 */
slouken@5147
   684
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
slouken@5147
   685
                                                       SDL_BlendMode *blendMode);
slouken@5145
   686
slouken@5145
   687
/**
slouken@5145
   688
 *  \brief Clear the current rendering target with the drawing color
slouken@5297
   689
 *
slouken@10408
   690
 *  This function clears the entire rendering target, ignoring the viewport and
slouken@10408
   691
 *  the clip rectangle.
philipp@7168
   692
 *
philipp@7168
   693
 *  \return 0 on success, or -1 on error
slouken@5145
   694
 */
slouken@5147
   695
extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
slouken@5145
   696
slouken@5145
   697
/**
slouken@5145
   698
 *  \brief Draw a point on the current rendering target.
slouken@7191
   699
 *
philipp@7188
   700
 *  \param renderer The renderer which should draw a point.
slouken@5145
   701
 *  \param x The x coordinate of the point.
slouken@5145
   702
 *  \param y The y coordinate of the point.
slouken@7191
   703
 *
slouken@5147
   704
 *  \return 0 on success, or -1 on error
slouken@5145
   705
 */
slouken@5147
   706
extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
slouken@5147
   707
                                                int x, int y);
slouken@5145
   708
slouken@5145
   709
/**
slouken@5145
   710
 *  \brief Draw multiple points on the current rendering target.
slouken@7191
   711
 *
philipp@7188
   712
 *  \param renderer The renderer which should draw multiple points.
slouken@5145
   713
 *  \param points The points to draw
slouken@5145
   714
 *  \param count The number of points to draw
slouken@7191
   715
 *
slouken@5147
   716
 *  \return 0 on success, or -1 on error
slouken@5145
   717
 */
slouken@5147
   718
extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
slouken@5147
   719
                                                 const SDL_Point * points,
slouken@5145
   720
                                                 int count);
slouken@5145
   721
slouken@5145
   722
/**
slouken@5145
   723
 *  \brief Draw a line on the current rendering target.
slouken@7191
   724
 *
philipp@7188
   725
 *  \param renderer The renderer which should draw a line.
slouken@5145
   726
 *  \param x1 The x coordinate of the start point.
slouken@5145
   727
 *  \param y1 The y coordinate of the start point.
slouken@5145
   728
 *  \param x2 The x coordinate of the end point.
slouken@5145
   729
 *  \param y2 The y coordinate of the end point.
slouken@7191
   730
 *
slouken@5147
   731
 *  \return 0 on success, or -1 on error
slouken@5145
   732
 */
slouken@5147
   733
extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
slouken@5147
   734
                                               int x1, int y1, int x2, int y2);
slouken@5145
   735
slouken@5145
   736
/**
slouken@5145
   737
 *  \brief Draw a series of connected lines on the current rendering target.
slouken@7191
   738
 *
philipp@7188
   739
 *  \param renderer The renderer which should draw multiple lines.
slouken@5145
   740
 *  \param points The points along the lines
slouken@5145
   741
 *  \param count The number of points, drawing count-1 lines
slouken@7191
   742
 *
slouken@5147
   743
 *  \return 0 on success, or -1 on error
slouken@5145
   744
 */
slouken@5147
   745
extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
slouken@5147
   746
                                                const SDL_Point * points,
slouken@5145
   747
                                                int count);
slouken@5145
   748
slouken@5145
   749
/**
slouken@5145
   750
 *  \brief Draw a rectangle on the current rendering target.
slouken@7191
   751
 *
philipp@7188
   752
 *  \param renderer The renderer which should draw a rectangle.
slouken@5145
   753
 *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
slouken@7191
   754
 *
slouken@5147
   755
 *  \return 0 on success, or -1 on error
slouken@5145
   756
 */
slouken@5147
   757
extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
slouken@5147
   758
                                               const SDL_Rect * rect);
slouken@5145
   759
slouken@5145
   760
/**
slouken@5145
   761
 *  \brief Draw some number of rectangles on the current rendering target.
slouken@7191
   762
 *
philipp@7188
   763
 *  \param renderer The renderer which should draw multiple rectangles.
slouken@5145
   764
 *  \param rects A pointer to an array of destination rectangles.
slouken@5145
   765
 *  \param count The number of rectangles.
slouken@7191
   766
 *
slouken@5147
   767
 *  \return 0 on success, or -1 on error
slouken@5145
   768
 */
slouken@5147
   769
extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
slouken@5297
   770
                                                const SDL_Rect * rects,
slouken@5147
   771
                                                int count);
slouken@5145
   772
slouken@5145
   773
/**
slouken@5145
   774
 *  \brief Fill a rectangle on the current rendering target with the drawing color.
slouken@7191
   775
 *
philipp@7188
   776
 *  \param renderer The renderer which should fill a rectangle.
slouken@7191
   777
 *  \param rect A pointer to the destination rectangle, or NULL for the entire
slouken@5145
   778
 *              rendering target.
slouken@7191
   779
 *
slouken@5147
   780
 *  \return 0 on success, or -1 on error
slouken@5145
   781
 */
slouken@5147
   782
extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
slouken@5147
   783
                                               const SDL_Rect * rect);
slouken@5145
   784
slouken@5145
   785
/**
slouken@5145
   786
 *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
slouken@7191
   787
 *
philipp@7188
   788
 *  \param renderer The renderer which should fill multiple rectangles.
slouken@5145
   789
 *  \param rects A pointer to an array of destination rectangles.
slouken@5145
   790
 *  \param count The number of rectangles.
slouken@7191
   791
 *
slouken@5147
   792
 *  \return 0 on success, or -1 on error
slouken@5145
   793
 */
slouken@5147
   794
extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
slouken@5486
   795
                                                const SDL_Rect * rects,
slouken@5147
   796
                                                int count);
slouken@5145
   797
slouken@5145
   798
/**
slouken@5145
   799
 *  \brief Copy a portion of the texture to the current rendering target.
slouken@7191
   800
 *
philipp@7188
   801
 *  \param renderer The renderer which should copy parts of a texture.
slouken@5145
   802
 *  \param texture The source texture.
slouken@7191
   803
 *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
slouken@5145
   804
 *                   texture.
slouken@7191
   805
 *  \param dstrect   A pointer to the destination rectangle, or NULL for the
slouken@5145
   806
 *                   entire rendering target.
slouken@7191
   807
 *
slouken@5147
   808
 *  \return 0 on success, or -1 on error
slouken@5145
   809
 */
slouken@5147
   810
extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
slouken@5147
   811
                                           SDL_Texture * texture,
slouken@5145
   812
                                           const SDL_Rect * srcrect,
slouken@5145
   813
                                           const SDL_Rect * dstrect);
slouken@5145
   814
gabomdq@6320
   815
/**
slouken@7191
   816
 *  \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
gabomdq@6320
   817
 *
philipp@7188
   818
 *  \param renderer The renderer which should copy parts of a texture.
gabomdq@6320
   819
 *  \param texture The source texture.
gabomdq@6320
   820
 *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
gabomdq@6320
   821
 *                   texture.
gabomdq@6320
   822
 *  \param dstrect   A pointer to the destination rectangle, or NULL for the
gabomdq@6320
   823
 *                   entire rendering target.
slouken@11224
   824
 *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
philipp@9323
   825
 *  \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).
slouken@6826
   826
 *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
slouken@7191
   827
 *
gabomdq@6320
   828
 *  \return 0 on success, or -1 on error
gabomdq@6320
   829
 */
gabomdq@6320
   830
extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
gabomdq@6320
   831
                                           SDL_Texture * texture,
gabomdq@6320
   832
                                           const SDL_Rect * srcrect,
gabomdq@6320
   833
                                           const SDL_Rect * dstrect,
gabomdq@6320
   834
                                           const double angle,
gabomdq@6320
   835
                                           const SDL_Point *center,
gabomdq@6320
   836
                                           const SDL_RendererFlip flip);
slouken@6232
   837
icculus@12352
   838
icculus@12352
   839
/**
icculus@12352
   840
 *  \brief Draw a point on the current rendering target.
icculus@12352
   841
 *
icculus@12352
   842
 *  \param renderer The renderer which should draw a point.
icculus@12352
   843
 *  \param x The x coordinate of the point.
icculus@12352
   844
 *  \param y The y coordinate of the point.
icculus@12352
   845
 *
icculus@12352
   846
 *  \return 0 on success, or -1 on error
icculus@12352
   847
 */
icculus@12352
   848
extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
icculus@12352
   849
                                                 float x, float y);
icculus@12352
   850
icculus@12352
   851
/**
icculus@12352
   852
 *  \brief Draw multiple points on the current rendering target.
icculus@12352
   853
 *
icculus@12352
   854
 *  \param renderer The renderer which should draw multiple points.
icculus@12352
   855
 *  \param points The points to draw
icculus@12352
   856
 *  \param count The number of points to draw
icculus@12352
   857
 *
icculus@12352
   858
 *  \return 0 on success, or -1 on error
icculus@12352
   859
 */
icculus@12352
   860
extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
icculus@12352
   861
                                                  const SDL_FPoint * points,
icculus@12352
   862
                                                  int count);
icculus@12352
   863
icculus@12352
   864
/**
icculus@12352
   865
 *  \brief Draw a line on the current rendering target.
icculus@12352
   866
 *
icculus@12352
   867
 *  \param renderer The renderer which should draw a line.
icculus@12352
   868
 *  \param x1 The x coordinate of the start point.
icculus@12352
   869
 *  \param y1 The y coordinate of the start point.
icculus@12352
   870
 *  \param x2 The x coordinate of the end point.
icculus@12352
   871
 *  \param y2 The y coordinate of the end point.
icculus@12352
   872
 *
icculus@12352
   873
 *  \return 0 on success, or -1 on error
icculus@12352
   874
 */
icculus@12352
   875
extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
icculus@12352
   876
                                                float x1, float y1, float x2, float y2);
icculus@12352
   877
icculus@12352
   878
/**
icculus@12352
   879
 *  \brief Draw a series of connected lines on the current rendering target.
icculus@12352
   880
 *
icculus@12352
   881
 *  \param renderer The renderer which should draw multiple lines.
icculus@12352
   882
 *  \param points The points along the lines
icculus@12352
   883
 *  \param count The number of points, drawing count-1 lines
icculus@12352
   884
 *
icculus@12352
   885
 *  \return 0 on success, or -1 on error
icculus@12352
   886
 */
icculus@12352
   887
extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
icculus@12352
   888
                                                const SDL_FPoint * points,
icculus@12352
   889
                                                int count);
icculus@12352
   890
icculus@12352
   891
/**
icculus@12352
   892
 *  \brief Draw a rectangle on the current rendering target.
icculus@12352
   893
 *
icculus@12352
   894
 *  \param renderer The renderer which should draw a rectangle.
icculus@12352
   895
 *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
icculus@12352
   896
 *
icculus@12352
   897
 *  \return 0 on success, or -1 on error
icculus@12352
   898
 */
icculus@12352
   899
extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
icculus@12352
   900
                                               const SDL_FRect * rect);
icculus@12352
   901
icculus@12352
   902
/**
icculus@12352
   903
 *  \brief Draw some number of rectangles on the current rendering target.
icculus@12352
   904
 *
icculus@12352
   905
 *  \param renderer The renderer which should draw multiple rectangles.
icculus@12352
   906
 *  \param rects A pointer to an array of destination rectangles.
icculus@12352
   907
 *  \param count The number of rectangles.
icculus@12352
   908
 *
icculus@12352
   909
 *  \return 0 on success, or -1 on error
icculus@12352
   910
 */
icculus@12352
   911
extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
icculus@12352
   912
                                                 const SDL_FRect * rects,
icculus@12352
   913
                                                 int count);
icculus@12352
   914
icculus@12352
   915
/**
icculus@12352
   916
 *  \brief Fill a rectangle on the current rendering target with the drawing color.
icculus@12352
   917
 *
icculus@12352
   918
 *  \param renderer The renderer which should fill a rectangle.
icculus@12352
   919
 *  \param rect A pointer to the destination rectangle, or NULL for the entire
icculus@12352
   920
 *              rendering target.
icculus@12352
   921
 *
icculus@12352
   922
 *  \return 0 on success, or -1 on error
icculus@12352
   923
 */
icculus@12352
   924
extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
icculus@12352
   925
                                                const SDL_FRect * rect);
icculus@12352
   926
icculus@12352
   927
/**
icculus@12352
   928
 *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
icculus@12352
   929
 *
icculus@12352
   930
 *  \param renderer The renderer which should fill multiple rectangles.
icculus@12352
   931
 *  \param rects A pointer to an array of destination rectangles.
icculus@12352
   932
 *  \param count The number of rectangles.
icculus@12352
   933
 *
icculus@12352
   934
 *  \return 0 on success, or -1 on error
icculus@12352
   935
 */
icculus@12352
   936
extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
icculus@12352
   937
                                                 const SDL_FRect * rects,
icculus@12352
   938
                                                 int count);
icculus@12352
   939
icculus@12352
   940
/**
icculus@12352
   941
 *  \brief Copy a portion of the texture to the current rendering target.
icculus@12352
   942
 *
icculus@12352
   943
 *  \param renderer The renderer which should copy parts of a texture.
icculus@12352
   944
 *  \param texture The source texture.
icculus@12352
   945
 *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
icculus@12352
   946
 *                   texture.
icculus@12352
   947
 *  \param dstrect   A pointer to the destination rectangle, or NULL for the
icculus@12352
   948
 *                   entire rendering target.
icculus@12352
   949
 *
icculus@12352
   950
 *  \return 0 on success, or -1 on error
icculus@12352
   951
 */
icculus@12352
   952
extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
icculus@12352
   953
                                            SDL_Texture * texture,
icculus@12352
   954
                                            const SDL_Rect * srcrect,
icculus@12352
   955
                                            const SDL_FRect * dstrect);
icculus@12352
   956
icculus@12352
   957
/**
icculus@12352
   958
 *  \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
icculus@12352
   959
 *
icculus@12352
   960
 *  \param renderer The renderer which should copy parts of a texture.
icculus@12352
   961
 *  \param texture The source texture.
icculus@12352
   962
 *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
icculus@12352
   963
 *                   texture.
icculus@12352
   964
 *  \param dstrect   A pointer to the destination rectangle, or NULL for the
icculus@12352
   965
 *                   entire rendering target.
icculus@12352
   966
 *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
icculus@12352
   967
 *  \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).
icculus@12352
   968
 *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
icculus@12352
   969
 *
icculus@12352
   970
 *  \return 0 on success, or -1 on error
icculus@12352
   971
 */
icculus@12352
   972
extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
icculus@12352
   973
                                            SDL_Texture * texture,
icculus@12352
   974
                                            const SDL_Rect * srcrect,
icculus@12352
   975
                                            const SDL_FRect * dstrect,
icculus@12352
   976
                                            const double angle,
icculus@12352
   977
                                            const SDL_FPoint *center,
icculus@12352
   978
                                            const SDL_RendererFlip flip);
icculus@12352
   979
slouken@6232
   980
/**
slouken@5145
   981
 *  \brief Read pixels from the current rendering target.
slouken@7191
   982
 *
philipp@7188
   983
 *  \param renderer The renderer from which pixels should be read.
slouken@7191
   984
 *  \param rect   A pointer to the rectangle to read, or NULL for the entire
slouken@5145
   985
 *                render target.
slouken@5145
   986
 *  \param format The desired format of the pixel data, or 0 to use the format
slouken@5145
   987
 *                of the rendering target
slouken@5145
   988
 *  \param pixels A pointer to be filled in with the pixel data
slouken@5145
   989
 *  \param pitch  The pitch of the pixels parameter.
slouken@7191
   990
 *
slouken@5145
   991
 *  \return 0 on success, or -1 if pixel reading is not supported.
slouken@7191
   992
 *
slouken@5145
   993
 *  \warning This is a very slow operation, and should not be used frequently.
slouken@5145
   994
 */
slouken@5147
   995
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
slouken@5147
   996
                                                 const SDL_Rect * rect,
slouken@5145
   997
                                                 Uint32 format,
slouken@5145
   998
                                                 void *pixels, int pitch);
slouken@5145
   999
slouken@5145
  1000
/**
slouken@5145
  1001
 *  \brief Update the screen with rendering performed.
slouken@5145
  1002
 */
slouken@5147
  1003
extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
slouken@5145
  1004
slouken@5145
  1005
/**
slouken@5145
  1006
 *  \brief Destroy the specified texture.
slouken@7191
  1007
 *
slouken@5145
  1008
 *  \sa SDL_CreateTexture()
slouken@5145
  1009
 *  \sa SDL_CreateTextureFromSurface()
slouken@5145
  1010
 */
slouken@5145
  1011
extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
slouken@5145
  1012
slouken@5145
  1013
/**
slouken@5145
  1014
 *  \brief Destroy the rendering context for a window and free associated
slouken@5145
  1015
 *         textures.
slouken@7191
  1016
 *
slouken@5145
  1017
 *  \sa SDL_CreateRenderer()
slouken@5145
  1018
 */
slouken@5147
  1019
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
slouken@5145
  1020
icculus@12290
  1021
/**
icculus@12290
  1022
 *  \brief Force the rendering context to flush any pending commands to the
icculus@12290
  1023
 *         underlying rendering API.
icculus@12290
  1024
 *
icculus@12290
  1025
 *  You do not need to (and in fact, shouldn't) call this function unless
icculus@12290
  1026
 *  you are planning to call into OpenGL/Direct3D/Metal/whatever directly
icculus@12290
  1027
 *  in addition to using an SDL_Renderer.
icculus@12290
  1028
 *
icculus@12290
  1029
 *  This is for a very-specific case: if you are using SDL's render API,
icculus@12290
  1030
 *  you asked for a specific renderer backend (OpenGL, Direct3D, etc),
icculus@12290
  1031
 *  you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make
icculus@12290
  1032
 *  OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of
icculus@12290
  1033
 *  this applies, you should call SDL_RenderFlush() between calls to SDL's
icculus@12290
  1034
 *  render API and the low-level API you're using in cooperation.
icculus@12290
  1035
 *
icculus@12290
  1036
 *  In all other cases, you can ignore this function. This is only here to
icculus@12290
  1037
 *  get maximum performance out of a specific situation. In all other cases,
icculus@12290
  1038
 *  SDL will do the right thing, perhaps at a performance loss.
icculus@12290
  1039
 *
icculus@12290
  1040
 *  This function is first available in SDL 2.0.10, and is not needed in
icculus@12290
  1041
 *  2.0.9 and earlier, as earlier versions did not queue rendering commands
icculus@12290
  1042
 *  at all, instead flushing them to the OS immediately.
icculus@12290
  1043
 */
icculus@12290
  1044
extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer);
icculus@12290
  1045
slouken@5145
  1046
gabomdq@6414
  1047
/**
gabomdq@6414
  1048
 *  \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
gabomdq@6414
  1049
 *         OpenGL instructions.
gabomdq@6414
  1050
 *
gabomdq@6414
  1051
 *  \param texture  The SDL texture to bind
gabomdq@6414
  1052
 *  \param texw     A pointer to a float that will be filled with the texture width
gabomdq@6414
  1053
 *  \param texh     A pointer to a float that will be filled with the texture height
gabomdq@6414
  1054
 *
gabomdq@6414
  1055
 *  \return 0 on success, or -1 if the operation is not supported
gabomdq@6414
  1056
 */
gabomdq@6414
  1057
extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
gabomdq@6414
  1058
gabomdq@6414
  1059
/**
gabomdq@6414
  1060
 *  \brief Unbind a texture from the current OpenGL/ES/ES2 context.
gabomdq@6414
  1061
 *
gabomdq@6414
  1062
 *  \param texture  The SDL texture to unbind
gabomdq@6414
  1063
 *
gabomdq@6414
  1064
 *  \return 0 on success, or -1 if the operation is not supported
gabomdq@6414
  1065
 */
gabomdq@6414
  1066
extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
gabomdq@6414
  1067
slouken@11744
  1068
/**
slouken@11744
  1069
 *  \brief Get the CAMetalLayer associated with the given Metal renderer
slouken@11744
  1070
 *
slouken@11744
  1071
 *  \param renderer The renderer to query
slouken@11744
  1072
 *
slouken@11744
  1073
 *  \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
slouken@11744
  1074
 *
slouken@11744
  1075
 *  \sa SDL_RenderGetMetalCommandEncoder()
slouken@11744
  1076
 */
slouken@11744
  1077
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
slouken@11744
  1078
slouken@11744
  1079
/**
slouken@11744
  1080
 *  \brief Get the Metal command encoder for the current frame
slouken@11744
  1081
 *
slouken@11744
  1082
 *  \param renderer The renderer to query
slouken@11744
  1083
 *
slouken@11744
  1084
 *  \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
slouken@11744
  1085
 *
slouken@11744
  1086
 *  \sa SDL_RenderGetMetalLayer()
slouken@11744
  1087
 */
slouken@11744
  1088
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
gabomdq@6414
  1089
slouken@5145
  1090
/* Ends C function definitions when using C++ */
slouken@5145
  1091
#ifdef __cplusplus
slouken@5145
  1092
}
slouken@5145
  1093
#endif
slouken@5145
  1094
#include "close_code.h"
slouken@5145
  1095
slouken@10638
  1096
#endif /* SDL_render_h_ */
slouken@5145
  1097
slouken@5145
  1098
/* vi: set ts=4 sw=4 expandtab: */