module lib.sdl2.render

Code Map

module lib.sdl2.render;


enum SDL_RENDERER_SOFTWARE;
enum SDL_RENDERER_ACCELERATED;
enum SDL_RENDERER_PRESENTVSYNC;
enum SDL_RENDERER_TARGETTEXTURE;
enum SDL_TEXTUREACCESS_STATIC;
enum SDL_TEXTUREACCESS_STREAMING;
enum SDL_TEXTUREACCESS_TARGET;
enum SDL_TEXTUREMODULATE_NONE;
enum SDL_TEXTUREMODULATE_COLOR;
enum SDL_TEXTUREMODULATE_ALPHA;
enum SDL_FLIP_NONE;
enum SDL_FLIP_HORIZONTAL;
enum SDL_FLIP_VERTICAL;

//! \brief Flags used when creating a rendering context
alias SDL_RendererFlags = i32;
//! \brief The access pattern allowed for a texture.
alias SDL_TextureAccess = i32;
//! \brief The texture channel modulation used in SDL_RenderCopy().
alias SDL_TextureModulate = i32;
//! \brief Flip constants for SDL_RenderCopyEx
alias SDL_RendererFlip = i32;

//! \brief Information on the capabilities of a render driver or context.
struct SDL_RendererInfo
{
public:
	name: char*;
	flags: Uint32;
	num_texture_formats: Uint32;
	texture_formats: Uint32[16];
	max_texture_width: i32;
	max_texture_height: i32;
}

//! \brief A structure representing rendering state
struct SDL_Renderer
{
}

//! \brief An efficient driver-specific representation of pixel data
struct SDL_Texture
{
}

//! \brief Get the number of 2D rendering drivers available for the
//! current display.
fn SDL_GetNumRenderDrivers() i32;
//! \brief Get information about a specific 2D rendering driver for the
//! current display.
fn SDL_GetRenderDriverInfo(index: i32, info: SDL_RendererInfo*) i32;
//! \brief Create a window and default renderer
fn SDL_CreateWindowAndRenderer(width: i32, height: i32, window_flags: Uint32, window: SDL_Window**, renderer: SDL_Renderer**) i32;
//! \brief Create a 2D rendering context for a window.
fn SDL_CreateRenderer(window: SDL_Window*, index: i32, flags: Uint32) SDL_Renderer*;
//! \brief Create a 2D software rendering context for a surface.
fn SDL_CreateSoftwareRenderer(surface: SDL_Surface*) SDL_Renderer*;
//! \brief Get the renderer associated with a window.
fn SDL_GetRenderer(window: SDL_Window*) SDL_Renderer*;
//! \brief Get information about a rendering context.
fn SDL_GetRendererInfo(renderer: SDL_Renderer*, info: SDL_RendererInfo*) i32;
//! \brief Get the output size of a rendering context.
fn SDL_GetRendererOutputSize(renderer: SDL_Renderer*, w: i32*, h: i32*) i32;
//! \brief Create a texture for a rendering context.
fn SDL_CreateTexture(renderer: SDL_Renderer*, format: Uint32, access: i32, w: i32, h: i32) SDL_Texture*;
//! \brief Create a texture from an existing surface.
fn SDL_CreateTextureFromSurface(renderer: SDL_Renderer*, surface: SDL_Surface*) SDL_Texture*;
//! \brief Query the attributes of a texture
fn SDL_QueryTexture(texture: SDL_Texture*, format: Uint32*, access: i32*, w: i32*, h: i32*) i32;
//! \brief Set an additional color value used in render copy operations.
fn SDL_SetTextureColorMod(texture: SDL_Texture*, r: Uint8, g: Uint8, b: Uint8) i32;
//! \brief Get the additional color value used in render copy operations.
fn SDL_GetTextureColorMod(texture: SDL_Texture*, r: Uint8*, g: Uint8*, b: Uint8*) i32;
//! \brief Set an additional alpha value used in render copy operations.
fn SDL_SetTextureAlphaMod(texture: SDL_Texture*, alpha: Uint8) i32;
//! \brief Get the additional alpha value used in render copy operations.
fn SDL_GetTextureAlphaMod(texture: SDL_Texture*, alpha: Uint8*) i32;
//! \brief Set the blend mode used for texture copy operations.
fn SDL_SetTextureBlendMode(texture: SDL_Texture*, blendMode: SDL_BlendMode) i32;
//! \brief Get the blend mode used for texture copy operations.
fn SDL_GetTextureBlendMode(texture: SDL_Texture*, blendMode: SDL_BlendMode*) i32;
//! \brief Update the given texture rectangle with new pixel data.
fn SDL_UpdateTexture(texture: SDL_Texture*, rect: const(const(SDL_Rect)*), pixels: const(const(void)*), pitch: i32) i32;
//! \brief Lock a portion of the texture for write-only pixel access.
fn SDL_LockTexture(texture: SDL_Texture*, rect: const(const(SDL_Rect)*), pixels: void**, pitch: i32*) i32;
//! \brief Unlock a texture, uploading the changes to video memory, if
//! needed.
fn SDL_UnlockTexture(texture: SDL_Texture*);
//! \brief Determines whether a window supports the use of render targets
fn SDL_RenderTargetSupported(renderer: SDL_Renderer*) SDL_bool;
//! \brief Set a texture as the current rendering target.
fn SDL_SetRenderTarget(renderer: SDL_Renderer*, texture: SDL_Texture*) i32;
//! \brief Get the current render target or NULL for the default render
//! target.
fn SDL_GetRenderTarget(renderer: SDL_Renderer*) SDL_Texture*;
//! \brief Set device independent resolution for rendering
fn SDL_RenderSetLogicalSize(renderer: SDL_Renderer*, w: i32, h: i32) i32;
//! \brief Set whether to force integer scales for resolution-independent
//! rendering
fn SDL_RenderSetIntegerScale(renderer: SDL_Renderer*, enable: SDL_bool) i32;
//! \brief Get whether integer scales are forced for
//! resolution-independent rendering
fn SDL_RenderGetIntegerScale(renderer: SDL_Renderer*) SDL_bool;
//! \brief Get device independent resolution for rendering
fn SDL_RenderGetLogicalSize(renderer: SDL_Renderer*, w: i32*, h: i32*);
//! \brief Set the drawing area for rendering on the current target.
fn SDL_RenderSetViewport(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32;
//! \brief Get the drawing area for the current target.
fn SDL_RenderGetViewport(renderer: SDL_Renderer*, rect: SDL_Rect*);
//! \brief Set the clip rectangle for the current target.
fn SDL_RenderSetClipRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32;
//! \brief Get the clip rectangle for the current target.
fn SDL_RenderGetClipRect(renderer: SDL_Renderer*, rect: SDL_Rect*);
//! \brief Set the drawing scale for rendering on the current target.
fn SDL_RenderSetScale(renderer: SDL_Renderer*, scaleX: f32, scaleY: f32) i32;
//! \brief Get the drawing scale for the current target.
fn SDL_RenderGetScale(renderer: SDL_Renderer*, scaleX: f32*, scaleY: f32*);
//! \brief Set the color used for drawing operations (Rect, Line and
//! Clear).
fn SDL_SetRenderDrawColor(renderer: SDL_Renderer*, r: Uint8, g: Uint8, b: Uint8, a: Uint8) i32;
//! \brief Get the color used for drawing operations (Rect, Line and
//! Clear).
fn SDL_GetRenderDrawColor(renderer: SDL_Renderer*, r: Uint8*, g: Uint8*, b: Uint8*, a: Uint8*) i32;
//! \brief Set the blend mode used for drawing operations (Fill and Line).
fn SDL_SetRenderDrawBlendMode(renderer: SDL_Renderer*, blendMode: SDL_BlendMode) i32;
//! \brief Get the blend mode used for drawing operations.
fn SDL_GetRenderDrawBlendMode(renderer: SDL_Renderer*, blendMode: SDL_BlendMode*) i32;
//! \brief Clear the current rendering target with the drawing color
fn SDL_RenderClear(renderer: SDL_Renderer*) i32;
//! \brief Draw a point on the current rendering target.
fn SDL_RenderDrawPoint(renderer: SDL_Renderer*, x: i32, y: i32) i32;
//! \brief Draw multiple points on the current rendering target.
fn SDL_RenderDrawPoints(renderer: SDL_Renderer*, points: const(const(SDL_Point)*), count: i32) i32;
//! \brief Draw a line on the current rendering target.
fn SDL_RenderDrawLine(renderer: SDL_Renderer*, x1: i32, y1: i32, x2: i32, y2: i32) i32;
//! \brief Draw a series of connected lines on the current rendering
//! target.
fn SDL_RenderDrawLines(renderer: SDL_Renderer*, points: const(const(SDL_Point)*), count: i32) i32;
//! \brief Draw a rectangle on the current rendering target.
fn SDL_RenderDrawRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32;
//! \brief Draw some number of rectangles on the current rendering target.
fn SDL_RenderDrawRects(renderer: SDL_Renderer*, rects: const(const(SDL_Rect)*), count: i32) i32;
//! \brief Fill a rectangle on the current rendering target with the
//! drawing color.
fn SDL_RenderFillRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32;
//! \brief Fill some number of rectangles on the current rendering target
//! with the drawing color.
fn SDL_RenderFillRects(renderer: SDL_Renderer*, rects: const(const(SDL_Rect)*), count: i32) i32;
//! \brief Copy a portion of the texture to the current rendering target.
fn SDL_RenderCopy(renderer: SDL_Renderer*, texture: SDL_Texture*, srcrect: const(const(SDL_Rect)*), dstrect: const(const(SDL_Rect)*)) i32;
//! \brief Copy a portion of the source texture to the current rendering
//! target, rotating it by angle around the given center
fn SDL_RenderCopyEx(renderer: SDL_Renderer*, texture: SDL_Texture*, srcrect: const(const(SDL_Rect)*), dstrect: const(const(SDL_Rect)*), angle: const(f64), center: const(const(SDL_Point)*), flip: const(SDL_RendererFlip)) i32;
//! \brief Read pixels from the current rendering target.
fn SDL_RenderReadPixels(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*), format: Uint32, pixels: void*, pitch: i32) i32;
//! \brief Update the screen with rendering performed.
fn SDL_RenderPresent(renderer: SDL_Renderer*);
//! \brief Destroy the specified texture.
fn SDL_DestroyTexture(texture: SDL_Texture*);
//! \brief Destroy the rendering context for a window and free associated
//! textures.
fn SDL_DestroyRenderer(renderer: SDL_Renderer*);
//! \brief Bind the texture to the current OpenGL/ES/ES2 context for use
//! with OpenGL instructions.
fn SDL_GL_BindTexture(texture: SDL_Texture*, texw: f32*, texh: f32*) i32;
//! \brief Unbind a texture from the current OpenGL/ES/ES2 context.
fn SDL_GL_UnbindTexture(texture: SDL_Texture*) i32;
alias SDL_RendererFlags

\brief Flags used when creating a rendering context

struct SDL_RendererInfo

\brief Information on the capabilities of a render driver or context.

alias SDL_TextureAccess

\brief The access pattern allowed for a texture.

alias SDL_TextureModulate

\brief The texture channel modulation used in SDL_RenderCopy().

alias SDL_RendererFlip

\brief Flip constants for SDL_RenderCopyEx

struct SDL_Renderer

\brief A structure representing rendering state

struct SDL_Texture

\brief An efficient driver-specific representation of pixel data

fn SDL_GetNumRenderDrivers() i32

\brief Get the number of 2D rendering drivers available for the current display.

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.

\sa SDL_GetRenderDriverInfo() \sa SDL_CreateRenderer()

fn SDL_GetRenderDriverInfo(index: i32, info: SDL_RendererInfo*) i32

\brief Get information about a specific 2D rendering driver for the current display.

\param index The index of the driver to query information about. \param info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.

\return 0 on success, -1 if the index was out of range.

\sa SDL_CreateRenderer()

fn SDL_CreateWindowAndRenderer(width: i32, height: i32, window_flags: Uint32, window: SDL_Window**, renderer: SDL_Renderer**) i32

\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

fn SDL_CreateRenderer(window: SDL_Window*, index: i32, flags: Uint32) SDL_Renderer*

\brief Create a 2D rendering context for a window.

\param window The window where rendering is displayed. \param index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags. \param flags ::SDL_RendererFlags.

\return A valid rendering context or NULL if there was an error.

\sa SDL_CreateSoftwareRenderer() \sa SDL_GetRendererInfo() \sa SDL_DestroyRenderer()

fn SDL_CreateSoftwareRenderer(surface: SDL_Surface*) SDL_Renderer*

\brief Create a 2D software rendering context for a surface.

\param surface The surface where rendering is done.

\return A valid rendering context or NULL if there was an error.

\sa SDL_CreateRenderer() \sa SDL_DestroyRenderer()

fn SDL_GetRenderer(window: SDL_Window*) SDL_Renderer*

\brief Get the renderer associated with a window.

fn SDL_GetRendererInfo(renderer: SDL_Renderer*, info: SDL_RendererInfo*) i32

\brief Get information about a rendering context.

fn SDL_GetRendererOutputSize(renderer: SDL_Renderer*, w: i32*, h: i32*) i32

\brief Get the output size of a rendering context.

fn SDL_CreateTexture(renderer: SDL_Renderer*, format: Uint32, access: i32, w: i32, h: i32) SDL_Texture*

\brief Create a texture for a rendering context.

\param renderer The renderer. \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.

\return The created texture is returned, or 0 if no rendering context was active, the format was unsupported, or the width or height were out of range.

\sa SDL_QueryTexture() \sa SDL_UpdateTexture() \sa SDL_DestroyTexture()

fn SDL_CreateTextureFromSurface(renderer: SDL_Renderer*, surface: SDL_Surface*) SDL_Texture*

\brief Create a texture from an existing surface.

\param renderer The renderer. \param surface The surface containing pixel data used to fill the texture.

\return The created texture is returned, or 0 on error.

\note The surface is not modified or freed by this function.

\sa SDL_QueryTexture() \sa SDL_DestroyTexture()

fn SDL_QueryTexture(texture: SDL_Texture*, format: Uint32*, access: i32*, w: i32*, h: i32*) i32

\brief Query the attributes of a texture

\param texture A texture to be queried. \param format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this 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.

\return 0 on success, or -1 if the texture is not valid.

fn SDL_SetTextureColorMod(texture: SDL_Texture*, r: Uint8, g: Uint8, b: Uint8) i32

\brief Set an additional color value used in render copy operations.

\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.

\return 0 on success, or -1 if the texture is not valid or color modulation is not supported.

\sa SDL_GetTextureColorMod()

fn SDL_GetTextureColorMod(texture: SDL_Texture*, r: Uint8*, g: Uint8*, b: Uint8*) i32

\brief Get the additional color value used in render copy operations.

\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.

\return 0 on success, or -1 if the texture is not valid.

\sa SDL_SetTextureColorMod()

fn SDL_SetTextureAlphaMod(texture: SDL_Texture*, alpha: Uint8) i32

\brief Set an additional alpha value used in render copy operations.

\param texture The texture to update. \param alpha The alpha value multiplied into copy operations.

\return 0 on success, or -1 if the texture is not valid or alpha modulation is not supported.

\sa SDL_GetTextureAlphaMod()

fn SDL_GetTextureAlphaMod(texture: SDL_Texture*, alpha: Uint8*) i32

\brief Get the additional alpha value used in render copy operations.

\param texture The texture to query. \param alpha A pointer filled in with the current alpha value.

\return 0 on success, or -1 if the texture is not valid.

\sa SDL_SetTextureAlphaMod()

fn SDL_SetTextureBlendMode(texture: SDL_Texture*, blendMode: SDL_BlendMode) i32

\brief Set the blend mode used for texture copy operations.

\param texture The texture to update. \param blendMode ::SDL_BlendMode to use for texture blending.

\return 0 on success, or -1 if the texture is not valid or the blend mode is not supported.

\note If the blend mode is not supported, the closest supported mode is chosen.

\sa SDL_GetTextureBlendMode()

fn SDL_GetTextureBlendMode(texture: SDL_Texture*, blendMode: SDL_BlendMode*) i32

\brief Get the blend mode used for texture copy operations.

\param texture The texture to query. \param blendMode A pointer filled in with the current blend mode.

\return 0 on success, or -1 if the texture is not valid.

\sa SDL_SetTextureBlendMode()

fn SDL_UpdateTexture(texture: SDL_Texture*, rect: const(const(SDL_Rect)*), pixels: const(const(void)*), pitch: i32) i32

\brief Update the given texture rectangle with new pixel data.

\param texture The texture to update \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. \param pixels The raw pixel data. \param pitch The number of bytes between rows of pixel data.

\return 0 on success, or -1 if the texture is not valid.

\note This is a fairly slow function.

fn SDL_LockTexture(texture: SDL_Texture*, rect: const(const(SDL_Rect)*), pixels: void**, pitch: i32*) i32

\brief Lock a portion of the texture for write-only pixel access.

\param texture The texture to lock for access, which was created with ::SDL_TEXTUREACCESS_STREAMING. \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. \param pitch This is filled in with the pitch of the locked pixels.

\return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.

\sa SDL_UnlockTexture()

fn SDL_UnlockTexture(texture: SDL_Texture*)

\brief Unlock a texture, uploading the changes to video memory, if needed.

\sa SDL_LockTexture()

fn SDL_RenderTargetSupported(renderer: SDL_Renderer*) SDL_bool

\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.

fn SDL_SetRenderTarget(renderer: SDL_Renderer*, texture: SDL_Texture*) i32

\brief Set a texture as the current rendering target.

\param renderer The renderer. \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()

fn SDL_GetRenderTarget(renderer: SDL_Renderer*) SDL_Texture*

\brief Get the current render target or NULL for the default render target.

\return The current render target

\sa SDL_SetRenderTarget()

fn SDL_RenderSetLogicalSize(renderer: SDL_Renderer*, w: i32, h: i32) i32

\brief Set device independent resolution for rendering

\param renderer The renderer for which resolution should be set. \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.

\note If this function results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints.

\sa SDL_RenderGetLogicalSize() \sa SDL_RenderSetScale() \sa SDL_RenderSetViewport()

fn SDL_RenderSetIntegerScale(renderer: SDL_Renderer*, enable: SDL_bool) i32

\brief Set whether to force integer scales for resolution-independent rendering

\param renderer The renderer for which integer scaling should be set. \param enable Enable or disable integer scaling

This function restricts the logical viewport to integer values - that is, when a resolution is between two multiples of a logical size, the viewport size is rounded down to the lower multiple.

\sa SDL_RenderSetLogicalSize()

fn SDL_RenderGetIntegerScale(renderer: SDL_Renderer*) SDL_bool

\brief Get whether integer scales are forced for resolution-independent rendering

\param renderer The renderer from which integer scaling should be queried.

\sa SDL_RenderSetIntegerScale()

fn SDL_RenderGetLogicalSize(renderer: SDL_Renderer*, w: i32*, h: i32*)

\brief Get device independent resolution for rendering

\param renderer The renderer from which resolution should be queried. \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()

fn SDL_RenderSetViewport(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32

\brief Set the drawing area for rendering on the current target.

\param renderer The renderer for which the drawing area should be set. \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.

\return 0 on success, or -1 on error

\note If the window associated with the renderer is resized, the viewport is automatically reset.

\sa SDL_RenderGetViewport() \sa SDL_RenderSetLogicalSize()

fn SDL_RenderGetViewport(renderer: SDL_Renderer*, rect: SDL_Rect*)

\brief Get the drawing area for the current target.

\sa SDL_RenderSetViewport()

fn SDL_RenderSetClipRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32

\brief Set the clip rectangle for the current target.

\param renderer The renderer for which clip rectangle should be set. \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()

fn SDL_RenderGetClipRect(renderer: SDL_Renderer*, rect: SDL_Rect*)

\brief Get the clip rectangle for the current target.

\param renderer The renderer from which clip rectangle should be queried. \param rect A pointer filled in with the current clip rectangle, or an empty rectangle if clipping is disabled.

\sa SDL_RenderSetClipRect()

fn SDL_RenderSetScale(renderer: SDL_Renderer*, scaleX: f32, scaleY: f32) i32

\brief Set the drawing scale for rendering on the current target.

\param renderer The renderer for which the drawing scale should be set. \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.

\note If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.

\sa SDL_RenderGetScale() \sa SDL_RenderSetLogicalSize()

fn SDL_RenderGetScale(renderer: SDL_Renderer*, scaleX: f32*, scaleY: f32*)

\brief Get the drawing scale for the current target.

\param renderer The renderer from which drawing scale should be queried. \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()

fn SDL_SetRenderDrawColor(renderer: SDL_Renderer*, r: Uint8, g: Uint8, b: Uint8, a: Uint8) i32

\brief Set the color used for drawing operations (Rect, Line and Clear).

\param renderer The renderer for which drawing color should be set. \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. \param a The alpha value used to draw on the rendering target, usually ::SDL_ALPHA_OPAQUE (255).

\return 0 on success, or -1 on error

fn SDL_GetRenderDrawColor(renderer: SDL_Renderer*, r: Uint8*, g: Uint8*, b: Uint8*, a: Uint8*) i32

\brief Get the color used for drawing operations (Rect, Line and Clear).

\param renderer The renderer from which drawing color should be queried. \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. \param a A pointer to the alpha value used to draw on the rendering target, usually ::SDL_ALPHA_OPAQUE (255).

\return 0 on success, or -1 on error

fn SDL_SetRenderDrawBlendMode(renderer: SDL_Renderer*, blendMode: SDL_BlendMode) i32

\brief Set the blend mode used for drawing operations (Fill and Line).

\param renderer The renderer for which blend mode should be set. \param blendMode ::SDL_BlendMode to use for blending.

\return 0 on success, or -1 on error

\note If the blend mode is not supported, the closest supported mode is chosen.

\sa SDL_GetRenderDrawBlendMode()

fn SDL_GetRenderDrawBlendMode(renderer: SDL_Renderer*, blendMode: SDL_BlendMode*) i32

\brief Get the blend mode used for drawing operations.

\param renderer The renderer from which blend mode should be queried. \param blendMode A pointer filled in with the current blend mode.

\return 0 on success, or -1 on error

\sa SDL_SetRenderDrawBlendMode()

fn SDL_RenderClear(renderer: SDL_Renderer*) i32

\brief Clear the current rendering target with the drawing color

This function clears the entire rendering target, ignoring the viewport.

\return 0 on success, or -1 on error

fn SDL_RenderDrawPoint(renderer: SDL_Renderer*, x: i32, y: i32) i32

\brief Draw a point on the current rendering target.

\param renderer The renderer which should draw a point. \param x The x coordinate of the point. \param y The y coordinate of the point.

\return 0 on success, or -1 on error

fn SDL_RenderDrawPoints(renderer: SDL_Renderer*, points: const(const(SDL_Point)*), count: i32) i32

\brief Draw multiple points on the current rendering target.

\param renderer The renderer which should draw multiple points. \param points The points to draw \param count The number of points to draw

\return 0 on success, or -1 on error

fn SDL_RenderDrawLine(renderer: SDL_Renderer*, x1: i32, y1: i32, x2: i32, y2: i32) i32

\brief Draw a line on the current rendering target.

\param renderer The renderer which should draw a line. \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.

\return 0 on success, or -1 on error

fn SDL_RenderDrawLines(renderer: SDL_Renderer*, points: const(const(SDL_Point)*), count: i32) i32

\brief Draw a series of connected lines on the current rendering target.

\param renderer The renderer which should draw multiple lines. \param points The points along the lines \param count The number of points, drawing count-1 lines

\return 0 on success, or -1 on error

fn SDL_RenderDrawRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32

\brief Draw a rectangle on the current rendering target.

\param renderer The renderer which should draw a rectangle. \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.

\return 0 on success, or -1 on error

fn SDL_RenderDrawRects(renderer: SDL_Renderer*, rects: const(const(SDL_Rect)*), count: i32) i32

\brief Draw some number of rectangles on the current rendering target.

\param renderer The renderer which should draw multiple rectangles. \param rects A pointer to an array of destination rectangles. \param count The number of rectangles.

\return 0 on success, or -1 on error

fn SDL_RenderFillRect(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*)) i32

\brief Fill a rectangle on the current rendering target with the drawing color.

\param renderer The renderer which should fill a rectangle. \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.

\return 0 on success, or -1 on error

fn SDL_RenderFillRects(renderer: SDL_Renderer*, rects: const(const(SDL_Rect)*), count: i32) i32

\brief Fill some number of rectangles on the current rendering target with the drawing color.

\param renderer The renderer which should fill multiple rectangles. \param rects A pointer to an array of destination rectangles. \param count The number of rectangles.

\return 0 on success, or -1 on error

fn SDL_RenderCopy(renderer: SDL_Renderer*, texture: SDL_Texture*, srcrect: const(const(SDL_Rect)*), dstrect: const(const(SDL_Rect)*)) i32

\brief Copy a portion of the texture to the current rendering target.

\param renderer The renderer which should copy parts of a texture. \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.

\return 0 on success, or -1 on error

fn SDL_RenderCopyEx(renderer: SDL_Renderer*, texture: SDL_Texture*, srcrect: const(const(SDL_Rect)*), dstrect: const(const(SDL_Rect)*), angle: const(f64), center: const(const(SDL_Point)*), flip: const(SDL_RendererFlip)) i32

\brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center

\param renderer The renderer which should copy parts of a texture. \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) \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture

\return 0 on success, or -1 on error

fn SDL_RenderReadPixels(renderer: SDL_Renderer*, rect: const(const(SDL_Rect)*), format: Uint32, pixels: void*, pitch: i32) i32

\brief Read pixels from the current rendering target.

\param renderer The renderer from which pixels should be read. \param rect A pointer to the rectangle to read, or NULL for the entire 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.

\return 0 on success, or -1 if pixel reading is not supported.

\warning This is a very slow operation, and should not be used frequently.

fn SDL_RenderPresent(renderer: SDL_Renderer*)

\brief Update the screen with rendering performed.

fn SDL_DestroyTexture(texture: SDL_Texture*)

\brief Destroy the specified texture.

\sa SDL_CreateTexture() \sa SDL_CreateTextureFromSurface()

fn SDL_DestroyRenderer(renderer: SDL_Renderer*)

\brief Destroy the rendering context for a window and free associated textures.

\sa SDL_CreateRenderer()

fn SDL_GL_BindTexture(texture: SDL_Texture*, texw: f32*, texh: f32*) i32

\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

fn SDL_GL_UnbindTexture(texture: SDL_Texture*) i32

\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