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