Struct sdl2::render::Renderer [] [src]

pub struct Renderer<'a> { /* fields omitted */ }

2D rendering context

Methods

impl<'a> Renderer<'a>
[src]

Creates a 2D software rendering context for a surface.

This method should only fail if SDL2 is not built with rendering support, or there's an out-of-memory error.

Gets information about the rendering context.

Gets the associated window reference of the Renderer, if there is one.

Gets the associated window reference of the Renderer, if there is one.

Gets the associated surface reference of the Renderer, if there is one.

Gets the associated surface reference of the Renderer, if there is one.

Unwraps the window or surface the rendering context was created from.

impl<'a> Renderer<'a>
[src]

Texture-creating methods for the renderer

Creates a texture for a rendering context.

size is the width and height of the texture.

Shorthand for create_texture(format, TextureAccess::Static, size)

Shorthand for create_texture(format, TextureAccess::Streaming, size)

Shorthand for create_texture(format, TextureAccess::Target, size)

Creates a texture from an existing surface.

Remarks

The access hint for the created texture is TextureAccess::Static.

impl<'a> Renderer<'a>
[src]

Render target methods

Determine whether a window supports the use of render targets.

Gets the render target handle.

Returns None if the window does not support the use of render targets.

impl<'a> Renderer<'a>
[src]

Drawing methods

Sets the color used for drawing operations (Rect, Line and Clear).

Gets the color used for drawing operations (Rect, Line and Clear).

Sets the blend mode used for drawing operations (Fill and Line).

Gets the blend mode used for drawing operations.

Clears the current rendering target with the drawing color.

Updates the screen with any rendering performed since the previous call.

SDL's rendering functions operate on a backbuffer; that is, calling a rendering function such as draw_line() does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.

Gets the output size of a rendering context.

Sets a device independent resolution for rendering.

Gets device independent resolution for rendering.

Sets the drawing area for rendering on the current target.

Gets the drawing area for the current target.

Sets the clip rectangle for rendering on the specified target.

If the rectangle is None, clipping will be disabled.

Gets the clip rectangle for the current target.

Returns None if clipping is disabled.

Sets the drawing scale for rendering on the current target.

Gets the drawing scale for the current target.

Draws a point on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Draws multiple points on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Draws a line on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Draws a series of connected lines on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Draws a rectangle on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Draws some number of rectangles on the current rendering target. Errors if drawing fails for any reason (e.g. driver failure)

Fills a rectangle on the current rendering target with the drawing color. Errors if drawing fails for any reason (e.g. driver failure)

Fills some number of rectangles on the current rendering target with the drawing color. Errors if drawing fails for any reason (e.g. driver failure)

Copies a portion of the texture to the current rendering target.

  • If src is None, the entire texture is copied.
  • If dst is None, the texture will be stretched to fill the given rectangle.

Errors if drawing fails for any reason (e.g. driver failure), or if the provided texture does not belong to the renderer.

Copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.

  • If src is None, the entire texture is copied.
  • If dst is None, the texture will be stretched to fill the given rectangle.
  • If center is None, rotation will be done around the center point of dst, or src if dst is None.

Errors if drawing fails for any reason (e.g. driver failure), if the provided texture does not belong to the renderer, or if the driver does not support RenderCopyEx.

Reads pixels from the current rendering target.

Remarks

WARNING: This is a very slow operation, and should not be used frequently.

Trait Implementations

impl<'a> Drop for Renderer<'a>
[src]

A method called when the value goes out of scope. Read more