Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
845 lines (770 loc) · 31.1 KB

SDL_render.h

File metadata and controls

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