SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

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