2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
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.
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:
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.
25 * Header file for SDL 2D rendering functions.
27 * This API supports the following features:
28 * * single pixel points
29 * * single pixel lines
33 * The primitives may be drawn in opaque, blended, or additive modes.
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.
39 * This API is designed to accelerate simple 2D operations. You may
40 * want more functionality such as polygons and particle effects and
41 * in that case you should use SDL's OpenGL/Direct3D support or one
42 * of the many good 3D engines.
44 * These functions must be called from the main thread.
45 * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
51 #include "SDL_stdinc.h"
53 #include "SDL_video.h"
55 #include "begin_code.h"
56 /* Set up for C function definitions, even when using C++ */
62 * \brief Flags used when creating a rendering context
66 SDL_RENDERER_SOFTWARE
= 0x00000001, /**< The renderer is a software fallback */
67 SDL_RENDERER_ACCELERATED
= 0x00000002, /**< The renderer uses hardware
69 SDL_RENDERER_PRESENTVSYNC
= 0x00000004, /**< Present is synchronized
70 with the refresh rate */
71 SDL_RENDERER_TARGETTEXTURE
= 0x00000008 /**< The renderer supports
72 rendering to texture */
76 * \brief Information on the capabilities of a render driver or context.
78 typedef struct SDL_RendererInfo
80 const char *name
; /**< The name of the renderer */
81 Uint32 flags
; /**< Supported ::SDL_RendererFlags */
82 Uint32 num_texture_formats
; /**< The number of available texture formats */
83 Uint32 texture_formats
[16]; /**< The available texture formats */
84 int max_texture_width
; /**< The maximimum texture width */
85 int max_texture_height
; /**< The maximimum texture height */
89 * \brief The access pattern allowed for a texture.
93 SDL_TEXTUREACCESS_STATIC
, /**< Changes rarely, not lockable */
94 SDL_TEXTUREACCESS_STREAMING
, /**< Changes frequently, lockable */
95 SDL_TEXTUREACCESS_TARGET
/**< Texture can be used as a render target */
99 * \brief The texture channel modulation used in SDL_RenderCopy().
103 SDL_TEXTUREMODULATE_NONE
= 0x00000000, /**< No modulation */
104 SDL_TEXTUREMODULATE_COLOR
= 0x00000001, /**< srcC = srcC * color */
105 SDL_TEXTUREMODULATE_ALPHA
= 0x00000002 /**< srcA = srcA * alpha */
106 } SDL_TextureModulate
;
109 * \brief Flip constants for SDL_RenderCopyEx
113 SDL_FLIP_NONE
= 0x00000000, /**< Do not flip */
114 SDL_FLIP_HORIZONTAL
= 0x00000001, /**< flip horizontally */
115 SDL_FLIP_VERTICAL
= 0x00000002 /**< flip vertically */
119 * \brief A structure representing rendering state
122 typedef struct SDL_Renderer SDL_Renderer
;
125 * \brief An efficient driver-specific representation of pixel data
128 typedef struct SDL_Texture SDL_Texture
;
131 /* Function prototypes */
134 * \brief Get the number of 2D rendering drivers available for the current
137 * A render driver is a set of code that handles rendering and texture
138 * management on a particular display. Normally there is only one, but
139 * some drivers may have several available with different capabilities.
141 * \sa SDL_GetRenderDriverInfo()
142 * \sa SDL_CreateRenderer()
144 extern DECLSPEC
int SDLCALL
SDL_GetNumRenderDrivers(void);
147 * \brief Get information about a specific 2D rendering driver for the current
150 * \param index The index of the driver to query information about.
151 * \param info A pointer to an SDL_RendererInfo struct to be filled with
152 * information on the rendering driver.
154 * \return 0 on success, -1 if the index was out of range.
156 * \sa SDL_CreateRenderer()
158 extern DECLSPEC
int SDLCALL
SDL_GetRenderDriverInfo(int index
,
159 SDL_RendererInfo
* info
);
162 * \brief Create a window and default renderer
164 * \param width The width of the window
165 * \param height The height of the window
166 * \param window_flags The flags used to create the window
167 * \param window A pointer filled with the window, or NULL on error
168 * \param renderer A pointer filled with the renderer, or NULL on error
170 * \return 0 on success, or -1 on error
172 extern DECLSPEC
int SDLCALL
SDL_CreateWindowAndRenderer(
173 int width
, int height
, Uint32 window_flags
,
174 SDL_Window
**window
, SDL_Renderer
**renderer
);
178 * \brief Create a 2D rendering context for a window.
180 * \param window The window where rendering is displayed.
181 * \param index The index of the rendering driver to initialize, or -1 to
182 * initialize the first one supporting the requested flags.
183 * \param flags ::SDL_RendererFlags.
185 * \return A valid rendering context or NULL if there was an error.
187 * \sa SDL_CreateSoftwareRenderer()
188 * \sa SDL_GetRendererInfo()
189 * \sa SDL_DestroyRenderer()
191 extern DECLSPEC SDL_Renderer
* SDLCALL
SDL_CreateRenderer(SDL_Window
* window
,
192 int index
, Uint32 flags
);
195 * \brief Create a 2D software rendering context for a surface.
197 * \param surface The surface where rendering is done.
199 * \return A valid rendering context or NULL if there was an error.
201 * \sa SDL_CreateRenderer()
202 * \sa SDL_DestroyRenderer()
204 extern DECLSPEC SDL_Renderer
* SDLCALL
SDL_CreateSoftwareRenderer(SDL_Surface
* surface
);
207 * \brief Get the renderer associated with a window.
209 extern DECLSPEC SDL_Renderer
* SDLCALL
SDL_GetRenderer(SDL_Window
* window
);
212 * \brief Get information about a rendering context.
214 extern DECLSPEC
int SDLCALL
SDL_GetRendererInfo(SDL_Renderer
* renderer
,
215 SDL_RendererInfo
* info
);
218 * \brief Get the output size of a rendering context.
220 extern DECLSPEC
int SDLCALL
SDL_GetRendererOutputSize(SDL_Renderer
* renderer
,
224 * \brief Create a texture for a rendering context.
226 * \param renderer The renderer.
227 * \param format The format of the texture.
228 * \param access One of the enumerated values in ::SDL_TextureAccess.
229 * \param w The width of the texture in pixels.
230 * \param h The height of the texture in pixels.
232 * \return The created texture is returned, or 0 if no rendering context was
233 * active, the format was unsupported, or the width or height were out
236 * \sa SDL_QueryTexture()
237 * \sa SDL_UpdateTexture()
238 * \sa SDL_DestroyTexture()
240 extern DECLSPEC SDL_Texture
* SDLCALL
SDL_CreateTexture(SDL_Renderer
* renderer
,
246 * \brief Create a texture from an existing surface.
248 * \param renderer The renderer.
249 * \param surface The surface containing pixel data used to fill the texture.
251 * \return The created texture is returned, or 0 on error.
253 * \note The surface is not modified or freed by this function.
255 * \sa SDL_QueryTexture()
256 * \sa SDL_DestroyTexture()
258 extern DECLSPEC SDL_Texture
* SDLCALL
SDL_CreateTextureFromSurface(SDL_Renderer
* renderer
, SDL_Surface
* surface
);
261 * \brief Query the attributes of a texture
263 * \param texture A texture to be queried.
264 * \param format A pointer filled in with the raw format of the texture. The
265 * actual format may differ, but pixel transfers will use this
267 * \param access A pointer filled in with the actual access to the texture.
268 * \param w A pointer filled in with the width of the texture in pixels.
269 * \param h A pointer filled in with the height of the texture in pixels.
271 * \return 0 on success, or -1 if the texture is not valid.
273 extern DECLSPEC
int SDLCALL
SDL_QueryTexture(SDL_Texture
* texture
,
274 Uint32
* format
, int *access
,
278 * \brief Set an additional color value used in render copy operations.
280 * \param texture The texture to update.
281 * \param r The red color value multiplied into copy operations.
282 * \param g The green color value multiplied into copy operations.
283 * \param b The blue color value multiplied into copy operations.
285 * \return 0 on success, or -1 if the texture is not valid or color modulation
288 * \sa SDL_GetTextureColorMod()
290 extern DECLSPEC
int SDLCALL
SDL_SetTextureColorMod(SDL_Texture
* texture
,
291 Uint8 r
, Uint8 g
, Uint8 b
);
295 * \brief Get the additional color value used in render copy operations.
297 * \param texture The texture to query.
298 * \param r A pointer filled in with the current red color value.
299 * \param g A pointer filled in with the current green color value.
300 * \param b A pointer filled in with the current blue color value.
302 * \return 0 on success, or -1 if the texture is not valid.
304 * \sa SDL_SetTextureColorMod()
306 extern DECLSPEC
int SDLCALL
SDL_GetTextureColorMod(SDL_Texture
* texture
,
307 Uint8
* r
, Uint8
* g
,
311 * \brief Set an additional alpha value used in render copy operations.
313 * \param texture The texture to update.
314 * \param alpha The alpha value multiplied into copy operations.
316 * \return 0 on success, or -1 if the texture is not valid or alpha modulation
319 * \sa SDL_GetTextureAlphaMod()
321 extern DECLSPEC
int SDLCALL
SDL_SetTextureAlphaMod(SDL_Texture
* texture
,
325 * \brief Get the additional alpha value used in render copy operations.
327 * \param texture The texture to query.
328 * \param alpha A pointer filled in with the current alpha value.
330 * \return 0 on success, or -1 if the texture is not valid.
332 * \sa SDL_SetTextureAlphaMod()
334 extern DECLSPEC
int SDLCALL
SDL_GetTextureAlphaMod(SDL_Texture
* texture
,
338 * \brief Set the blend mode used for texture copy operations.
340 * \param texture The texture to update.
341 * \param blendMode ::SDL_BlendMode to use for texture blending.
343 * \return 0 on success, or -1 if the texture is not valid or the blend mode is
346 * \note If the blend mode is not supported, the closest supported mode is
349 * \sa SDL_GetTextureBlendMode()
351 extern DECLSPEC
int SDLCALL
SDL_SetTextureBlendMode(SDL_Texture
* texture
,
352 SDL_BlendMode blendMode
);
355 * \brief Get the blend mode used for texture copy operations.
357 * \param texture The texture to query.
358 * \param blendMode A pointer filled in with the current blend mode.
360 * \return 0 on success, or -1 if the texture is not valid.
362 * \sa SDL_SetTextureBlendMode()
364 extern DECLSPEC
int SDLCALL
SDL_GetTextureBlendMode(SDL_Texture
* texture
,
365 SDL_BlendMode
*blendMode
);
368 * \brief Update the given texture rectangle with new pixel data.
370 * \param texture The texture to update
371 * \param rect A pointer to the rectangle of pixels to update, or NULL to
372 * update the entire texture.
373 * \param pixels The raw pixel data.
374 * \param pitch The number of bytes between rows of pixel data.
376 * \return 0 on success, or -1 if the texture is not valid.
378 * \note This is a fairly slow function.
380 extern DECLSPEC
int SDLCALL
SDL_UpdateTexture(SDL_Texture
* texture
,
381 const SDL_Rect
* rect
,
382 const void *pixels
, int pitch
);
385 * \brief Lock a portion of the texture for write-only pixel access.
387 * \param texture The texture to lock for access, which was created with
388 * ::SDL_TEXTUREACCESS_STREAMING.
389 * \param rect A pointer to the rectangle to lock for access. If the rect
390 * is NULL, the entire texture will be locked.
391 * \param pixels This is filled in with a pointer to the locked pixels,
392 * appropriately offset by the locked area.
393 * \param pitch This is filled in with the pitch of the locked pixels.
395 * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
397 * \sa SDL_UnlockTexture()
399 extern DECLSPEC
int SDLCALL
SDL_LockTexture(SDL_Texture
* texture
,
400 const SDL_Rect
* rect
,
401 void **pixels
, int *pitch
);
404 * \brief Unlock a texture, uploading the changes to video memory, if needed.
406 * \sa SDL_LockTexture()
408 extern DECLSPEC
void SDLCALL
SDL_UnlockTexture(SDL_Texture
* texture
);
411 * \brief Determines whether a window supports the use of render targets
413 * \param renderer The renderer that will be checked
415 * \return SDL_TRUE if supported, SDL_FALSE if not.
417 extern DECLSPEC SDL_bool SDLCALL
SDL_RenderTargetSupported(SDL_Renderer
*renderer
);
420 * \brief Set a texture as the current rendering target.
422 * \param renderer The renderer.
423 * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
425 * \return 0 on success, or -1 on error
427 * \sa SDL_GetRenderTarget()
429 extern DECLSPEC
int SDLCALL
SDL_SetRenderTarget(SDL_Renderer
*renderer
,
430 SDL_Texture
*texture
);
433 * \brief Get the current render target or NULL for the default render target.
435 * \return The current render target
437 * \sa SDL_SetRenderTarget()
439 extern DECLSPEC SDL_Texture
* SDLCALL
SDL_GetRenderTarget(SDL_Renderer
*renderer
);
442 * \brief Set device independent resolution for rendering
444 * \param renderer The renderer for which resolution should be set.
445 * \param w The width of the logical resolution
446 * \param h The height of the logical resolution
448 * This function uses the viewport and scaling functionality to allow a fixed logical
449 * resolution for rendering, regardless of the actual output resolution. If the actual
450 * output resolution doesn't have the same aspect ratio the output rendering will be
451 * centered within the output display.
453 * If the output display is a window, mouse events in the window will be filtered
454 * and scaled so they seem to arrive within the logical resolution.
456 * \note If this function results in scaling or subpixel drawing by the
457 * rendering backend, it will be handled using the appropriate
460 * \sa SDL_RenderGetLogicalSize()
461 * \sa SDL_RenderSetScale()
462 * \sa SDL_RenderSetViewport()
464 extern DECLSPEC
int SDLCALL
SDL_RenderSetLogicalSize(SDL_Renderer
* renderer
, int w
, int h
);
467 * \brief Get device independent resolution for rendering
469 * \param renderer The renderer from which resolution should be queried.
470 * \param w A pointer filled with the width of the logical resolution
471 * \param h A pointer filled with the height of the logical resolution
473 * \sa SDL_RenderSetLogicalSize()
475 extern DECLSPEC
void SDLCALL
SDL_RenderGetLogicalSize(SDL_Renderer
* renderer
, int *w
, int *h
);
478 * \brief Set the drawing area for rendering on the current target.
480 * \param renderer The renderer for which the drawing area should be set.
481 * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
483 * The x,y of the viewport rect represents the origin for rendering.
485 * \return 0 on success, or -1 on error
487 * \note If the window associated with the renderer is resized, the viewport is automatically reset.
489 * \sa SDL_RenderGetViewport()
490 * \sa SDL_RenderSetLogicalSize()
492 extern DECLSPEC
int SDLCALL
SDL_RenderSetViewport(SDL_Renderer
* renderer
,
493 const SDL_Rect
* rect
);
496 * \brief Get the drawing area for the current target.
498 * \sa SDL_RenderSetViewport()
500 extern DECLSPEC
void SDLCALL
SDL_RenderGetViewport(SDL_Renderer
* renderer
,
504 * \brief Set the clip rectangle for the current target.
506 * \param renderer The renderer for which clip rectangle should be set.
507 * \param rect A pointer to the rectangle to set as the clip rectangle, or
508 * NULL to disable clipping.
510 * \return 0 on success, or -1 on error
512 * \sa SDL_RenderGetClipRect()
514 extern DECLSPEC
int SDLCALL
SDL_RenderSetClipRect(SDL_Renderer
* renderer
,
515 const SDL_Rect
* rect
);
518 * \brief Get the clip rectangle for the current target.
520 * \param renderer The renderer from which clip rectangle should be queried.
521 * \param rect A pointer filled in with the current clip rectangle, or
522 * an empty rectangle if clipping is disabled.
524 * \sa SDL_RenderSetClipRect()
526 extern DECLSPEC
void SDLCALL
SDL_RenderGetClipRect(SDL_Renderer
* renderer
,
530 * \brief Set the drawing scale for rendering on the current target.
532 * \param renderer The renderer for which the drawing scale should be set.
533 * \param scaleX The horizontal scaling factor
534 * \param scaleY The vertical scaling factor
536 * The drawing coordinates are scaled by the x/y scaling factors
537 * before they are used by the renderer. This allows resolution
538 * independent drawing with a single coordinate system.
540 * \note If this results in scaling or subpixel drawing by the
541 * rendering backend, it will be handled using the appropriate
542 * quality hints. For best results use integer scaling factors.
544 * \sa SDL_RenderGetScale()
545 * \sa SDL_RenderSetLogicalSize()
547 extern DECLSPEC
int SDLCALL
SDL_RenderSetScale(SDL_Renderer
* renderer
,
548 float scaleX
, float scaleY
);
551 * \brief Get the drawing scale for the current target.
553 * \param renderer The renderer from which drawing scale should be queried.
554 * \param scaleX A pointer filled in with the horizontal scaling factor
555 * \param scaleY A pointer filled in with the vertical scaling factor
557 * \sa SDL_RenderSetScale()
559 extern DECLSPEC
void SDLCALL
SDL_RenderGetScale(SDL_Renderer
* renderer
,
560 float *scaleX
, float *scaleY
);
563 * \brief Set the color used for drawing operations (Rect, Line and Clear).
565 * \param renderer The renderer for which drawing color should be set.
566 * \param r The red value used to draw on the rendering target.
567 * \param g The green value used to draw on the rendering target.
568 * \param b The blue value used to draw on the rendering target.
569 * \param a The alpha value used to draw on the rendering target, usually
570 * ::SDL_ALPHA_OPAQUE (255).
572 * \return 0 on success, or -1 on error
574 extern DECLSPEC
int SDL_SetRenderDrawColor(SDL_Renderer
* renderer
,
575 Uint8 r
, Uint8 g
, Uint8 b
,
579 * \brief Get the color used for drawing operations (Rect, Line and Clear).
581 * \param renderer The renderer from which drawing color should be queried.
582 * \param r A pointer to the red value used to draw on the rendering target.
583 * \param g A pointer to the green value used to draw on the rendering target.
584 * \param b A pointer to the blue value used to draw on the rendering target.
585 * \param a A pointer to the alpha value used to draw on the rendering target,
586 * usually ::SDL_ALPHA_OPAQUE (255).
588 * \return 0 on success, or -1 on error
590 extern DECLSPEC
int SDL_GetRenderDrawColor(SDL_Renderer
* renderer
,
591 Uint8
* r
, Uint8
* g
, Uint8
* b
,
595 * \brief Set the blend mode used for drawing operations (Fill and Line).
597 * \param renderer The renderer for which blend mode should be set.
598 * \param blendMode ::SDL_BlendMode to use for blending.
600 * \return 0 on success, or -1 on error
602 * \note If the blend mode is not supported, the closest supported mode is
605 * \sa SDL_GetRenderDrawBlendMode()
607 extern DECLSPEC
int SDLCALL
SDL_SetRenderDrawBlendMode(SDL_Renderer
* renderer
,
608 SDL_BlendMode blendMode
);
611 * \brief Get the blend mode used for drawing operations.
613 * \param renderer The renderer from which blend mode should be queried.
614 * \param blendMode A pointer filled in with the current blend mode.
616 * \return 0 on success, or -1 on error
618 * \sa SDL_SetRenderDrawBlendMode()
620 extern DECLSPEC
int SDLCALL
SDL_GetRenderDrawBlendMode(SDL_Renderer
* renderer
,
621 SDL_BlendMode
*blendMode
);
624 * \brief Clear the current rendering target with the drawing color
626 * This function clears the entire rendering target, ignoring the viewport.
628 * \return 0 on success, or -1 on error
630 extern DECLSPEC
int SDLCALL
SDL_RenderClear(SDL_Renderer
* renderer
);
633 * \brief Draw a point on the current rendering target.
635 * \param renderer The renderer which should draw a point.
636 * \param x The x coordinate of the point.
637 * \param y The y coordinate of the point.
639 * \return 0 on success, or -1 on error
641 extern DECLSPEC
int SDLCALL
SDL_RenderDrawPoint(SDL_Renderer
* renderer
,
645 * \brief Draw multiple points on the current rendering target.
647 * \param renderer The renderer which should draw multiple points.
648 * \param points The points to draw
649 * \param count The number of points to draw
651 * \return 0 on success, or -1 on error
653 extern DECLSPEC
int SDLCALL
SDL_RenderDrawPoints(SDL_Renderer
* renderer
,
654 const SDL_Point
* points
,
658 * \brief Draw a line on the current rendering target.
660 * \param renderer The renderer which should draw a line.
661 * \param x1 The x coordinate of the start point.
662 * \param y1 The y coordinate of the start point.
663 * \param x2 The x coordinate of the end point.
664 * \param y2 The y coordinate of the end point.
666 * \return 0 on success, or -1 on error
668 extern DECLSPEC
int SDLCALL
SDL_RenderDrawLine(SDL_Renderer
* renderer
,
669 int x1
, int y1
, int x2
, int y2
);
672 * \brief Draw a series of connected lines on the current rendering target.
674 * \param renderer The renderer which should draw multiple lines.
675 * \param points The points along the lines
676 * \param count The number of points, drawing count-1 lines
678 * \return 0 on success, or -1 on error
680 extern DECLSPEC
int SDLCALL
SDL_RenderDrawLines(SDL_Renderer
* renderer
,
681 const SDL_Point
* points
,
685 * \brief Draw a rectangle on the current rendering target.
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.
690 * \return 0 on success, or -1 on error
692 extern DECLSPEC
int SDLCALL
SDL_RenderDrawRect(SDL_Renderer
* renderer
,
693 const SDL_Rect
* rect
);
696 * \brief Draw some number of rectangles on the current rendering target.
698 * \param renderer The renderer which should draw multiple rectangles.
699 * \param rects A pointer to an array of destination rectangles.
700 * \param count The number of rectangles.
702 * \return 0 on success, or -1 on error
704 extern DECLSPEC
int SDLCALL
SDL_RenderDrawRects(SDL_Renderer
* renderer
,
705 const SDL_Rect
* rects
,
709 * \brief Fill a rectangle on the current rendering target with the drawing color.
711 * \param renderer The renderer which should fill a rectangle.
712 * \param rect A pointer to the destination rectangle, or NULL for the entire
715 * \return 0 on success, or -1 on error
717 extern DECLSPEC
int SDLCALL
SDL_RenderFillRect(SDL_Renderer
* renderer
,
718 const SDL_Rect
* rect
);
721 * \brief Fill some number of rectangles on the current rendering target with the drawing color.
723 * \param renderer The renderer which should fill multiple rectangles.
724 * \param rects A pointer to an array of destination rectangles.
725 * \param count The number of rectangles.
727 * \return 0 on success, or -1 on error
729 extern DECLSPEC
int SDLCALL
SDL_RenderFillRects(SDL_Renderer
* renderer
,
730 const SDL_Rect
* rects
,
734 * \brief Copy a portion of the texture to the current rendering target.
736 * \param renderer The renderer which should copy parts of a texture.
737 * \param texture The source texture.
738 * \param srcrect A pointer to the source rectangle, or NULL for the entire
740 * \param dstrect A pointer to the destination rectangle, or NULL for the
741 * entire rendering target.
743 * \return 0 on success, or -1 on error
745 extern DECLSPEC
int SDLCALL
SDL_RenderCopy(SDL_Renderer
* renderer
,
746 SDL_Texture
* texture
,
747 const SDL_Rect
* srcrect
,
748 const SDL_Rect
* dstrect
);
751 * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
753 * \param renderer The renderer which should copy parts of a texture.
754 * \param texture The source texture.
755 * \param srcrect A pointer to the source rectangle, or NULL for the entire
757 * \param dstrect A pointer to the destination rectangle, or NULL for the
758 * entire rendering target.
759 * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
760 * \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)
761 * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
763 * \return 0 on success, or -1 on error
765 extern DECLSPEC
int SDLCALL
SDL_RenderCopyEx(SDL_Renderer
* renderer
,
766 SDL_Texture
* texture
,
767 const SDL_Rect
* srcrect
,
768 const SDL_Rect
* dstrect
,
770 const SDL_Point
*center
,
771 const SDL_RendererFlip flip
);
774 * \brief Read pixels from the current rendering target.
776 * \param renderer The renderer from which pixels should be read.
777 * \param rect A pointer to the rectangle to read, or NULL for the entire
779 * \param format The desired format of the pixel data, or 0 to use the format
780 * of the rendering target
781 * \param pixels A pointer to be filled in with the pixel data
782 * \param pitch The pitch of the pixels parameter.
784 * \return 0 on success, or -1 if pixel reading is not supported.
786 * \warning This is a very slow operation, and should not be used frequently.
788 extern DECLSPEC
int SDLCALL
SDL_RenderReadPixels(SDL_Renderer
* renderer
,
789 const SDL_Rect
* rect
,
791 void *pixels
, int pitch
);
794 * \brief Update the screen with rendering performed.
796 extern DECLSPEC
void SDLCALL
SDL_RenderPresent(SDL_Renderer
* renderer
);
799 * \brief Destroy the specified texture.
801 * \sa SDL_CreateTexture()
802 * \sa SDL_CreateTextureFromSurface()
804 extern DECLSPEC
void SDLCALL
SDL_DestroyTexture(SDL_Texture
* texture
);
807 * \brief Destroy the rendering context for a window and free associated
810 * \sa SDL_CreateRenderer()
812 extern DECLSPEC
void SDLCALL
SDL_DestroyRenderer(SDL_Renderer
* renderer
);
816 * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
817 * OpenGL instructions.
819 * \param texture The SDL texture to bind
820 * \param texw A pointer to a float that will be filled with the texture width
821 * \param texh A pointer to a float that will be filled with the texture height
823 * \return 0 on success, or -1 if the operation is not supported
825 extern DECLSPEC
int SDLCALL
SDL_GL_BindTexture(SDL_Texture
*texture
, float *texw
, float *texh
);
828 * \brief Unbind a texture from the current OpenGL/ES/ES2 context.
830 * \param texture The SDL texture to unbind
832 * \return 0 on success, or -1 if the operation is not supported
834 extern DECLSPEC
int SDLCALL
SDL_GL_UnbindTexture(SDL_Texture
*texture
);
837 /* Ends C function definitions when using C++ */
841 #include "close_code.h"
843 #endif /* _SDL_render_h */
845 /* vi: set ts=4 sw=4 expandtab: */