~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to system/include/SDL/SDL_render.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

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