Struct sdl2::render::Renderer
[−]
[src]
pub struct Renderer<'a> { // some fields omitted }
2D rendering context
Methods
impl<'a> Renderer<'a>
[src]
fn from_surface(surface: Surface<'a>) -> SdlResult<Renderer<'a>>
Creates a 2D software rendering context for a surface.
fn get_info(&self) -> RendererInfo
Gets information about the rendering context.
fn get_parent(&self) -> &RendererParent
Gets the window or surface the rendering context was created from.
fn get_parent_as_window(&self) -> Option<&Window>
fn get_parent_as_surface(&self) -> Option<&Surface>
fn window_properties<'b>(&'b mut self, sdl: &'b Sdl) -> Option<WindowProperties<'b>>
Accesses the Window properties, such as the position, size and title of a Window. Returns None if the renderer is not associated with a Window.
fn window_properties_getters(&self) -> Option<WindowPropertiesGetters>
Accesses the Window getters, such as the position, size and title of a Window. Returns None if the renderer is not associated with a Window.
fn unwrap_parent(self) -> RendererParent<'a>
fn unwrap_parent_as_window(self) -> Option<Window>
fn unwrap_parent_as_surface(self) -> Option<Surface<'a>>
fn drawer(&mut self) -> RenderDrawer
Provides drawing methods for the renderer.
Examples
use sdl2::render::Renderer; use sdl2::rect::Rect; fn test_draw(renderer: &mut Renderer) { let mut drawer = renderer.drawer(); drawer.clear(); drawer.draw_rect(Rect::new(50, 50, 150, 175)); drawer.present(); }
unsafe fn raw(&self) -> *mut SDL_Renderer
Unwraps the window or surface the rendering context was created from.
unsafe fn from_ll(raw: *mut SDL_Renderer, parent: RendererParent) -> Renderer
impl<'a> Renderer<'a>
[src]
Texture-creating methods for the renderer
fn create_texture(&self, format: PixelFormatEnum, access: TextureAccess, size: (i32, i32)) -> SdlResult<Texture>
Creates a texture for a rendering context.
size
is the width and height of the texture.
fn create_texture_static(&self, format: PixelFormatEnum, size: (i32, i32)) -> SdlResult<Texture>
Shorthand for create_texture(format, TextureAccess::Static, size)
fn create_texture_streaming(&self, format: PixelFormatEnum, size: (i32, i32)) -> SdlResult<Texture>
Shorthand for create_texture(format, TextureAccess::Streaming, size)
fn create_texture_target(&self, format: PixelFormatEnum, size: (i32, i32)) -> SdlResult<Texture>
Shorthand for create_texture(format, TextureAccess::Target, size)
fn create_texture_from_surface(&self, surface: &Surface) -> SdlResult<Texture>
Creates a texture from an existing surface.
Remarks
The access hint for the created texture is TextureAccess::Static
.