Files

233 lines
116 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Canvas` struct in crate `sdl2`."><meta name="keywords" content="rust, rustlang, rust-lang, Canvas"><title>sdl2::render::Canvas - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../sdl2/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Canvas</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.blend_mode">blend_mode</a><a href="#method.clear">clear</a><a href="#method.clip_rect">clip_rect</a><a href="#method.copy">copy</a><a href="#method.copy_ex">copy_ex</a><a href="#method.default_pixel_format">default_pixel_format</a><a href="#method.draw_color">draw_color</a><a href="#method.draw_line">draw_line</a><a href="#method.draw_lines">draw_lines</a><a href="#method.draw_point">draw_point</a><a href="#method.draw_points">draw_points</a><a href="#method.draw_rect">draw_rect</a><a href="#method.draw_rects">draw_rects</a><a href="#method.fill_rect">fill_rect</a><a href="#method.fill_rects">fill_rects</a><a href="#method.from_surface">from_surface</a><a href="#method.into_surface">into_surface</a><a href="#method.into_window">into_window</a><a href="#method.logical_size">logical_size</a><a href="#method.output_size">output_size</a><a href="#method.present">present</a><a href="#method.raw">raw</a><a href="#method.read_pixels">read_pixels</a><a href="#method.render_target_supported">render_target_supported</a><a href="#method.scale">scale</a><a href="#method.set_blend_mode">set_blend_mode</a><a href="#method.set_clip_rect">set_clip_rect</a><a href="#method.set_draw_color">set_draw_color</a><a href="#method.set_logical_size">set_logical_size</a><a href="#method.set_scale">set_scale</a><a href="#method.set_viewport">set_viewport</a><a href="#method.surface">surface</a><a href="#method.surface_mut">surface_mut</a><a href="#method.texture_creator">texture_creator</a><a href="#method.texture_creator-1">texture_creator</a><a href="#method.viewport">viewport</a><a href="#method.window">window</a><a href="#method.window_mut">window_mut</a><a href="#method.with_multiple_texture_canvas">with_multiple_texture_canvas</a><a href="#method.with_texture_canvas">with_texture_canvas</a></div><a class="sidebar-title" href="#deref-methods">Methods from Deref&lt;Target=RendererContext&lt;T::Context&gt;&gt;</a><div class="sidebar-links"><a href="#method.info">info</a><a href="#method.raw-1">raw</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Deref">Deref</a><a href="#impl-DrawRenderer">DrawRenderer</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#im
<p>If the <code>Window</code> manipulates the shell of the Window, <code>Canvas&lt;Window&gt;</code> allows you to
manipulate both the shell and the inside of the window;
you can manipulate pixel by pixel (<em>not recommended</em>), lines, colored rectangles, or paste
<code>Texture</code>s to this <code>Canvas</code>.</p>
<p>Drawing to the <code>Canvas</code> does not take effect immediately, it draws to a buffer until you
call <code>present()</code>, where all the operations you did until the last <code>present()</code>
are updated to your target</p>
<p>Its context may be shared with the <code>TextureCreator</code>.</p>
<p>The context will not be dropped until all references of it are out of scope.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">window</span> <span class="op">=</span> <span class="ident">video_subsystem</span>.<span class="ident">window</span>(<span class="string">&quot;Example&quot;</span>, <span class="number">800</span>, <span class="number">600</span>).<span class="ident">build</span>().<span class="ident">unwrap</span>();
<span class="comment">// Let&#39;s create a Canvas which we will use to draw in our Window</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">canvas</span> : <span class="ident">Canvas</span><span class="op">&lt;</span><span class="ident">Window</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">window</span>.<span class="ident">into_canvas</span>()
.<span class="ident">present_vsync</span>() <span class="comment">//&lt; this means the screen cannot</span>
<span class="comment">// render faster than your display rate (usually 60Hz or 144Hz)</span>
.<span class="ident">build</span>().<span class="ident">unwrap</span>();
<span class="ident">canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGB</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>));
<span class="comment">// fills the canvas with the color we set in `set_draw_color`.</span>
<span class="ident">canvas</span>.<span class="ident">clear</span>();
<span class="comment">// change the color of our drawing with a gold-color ...</span>
<span class="ident">canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGB</span>(<span class="number">255</span>, <span class="number">210</span>, <span class="number">0</span>));
<span class="comment">// A draw a rectangle which almost fills our window with it !</span>
<span class="ident">canvas</span>.<span class="ident">fill_rect</span>(<span class="ident">Rect</span>::<span class="ident">new</span>(<span class="number">10</span>, <span class="number">10</span>, <span class="number">780</span>, <span class="number">580</span>));
<span class="comment">// However the canvas has not been updated to the window yet,</span>
<span class="comment">// everything has been processed to an internal buffer,</span>
<span class="comment">// but if we want our buffer to be displayed on the window,</span>
<span class="comment">// we need to call `present`. We need to call this every time</span>
<span class="comment">// we want to render a new frame on the window.</span>
<span class="ident">canvas</span>.<span class="ident">present</span>();
<span class="comment">// present does not &quot;clear&quot; the buffer, that means that</span>
<span class="comment">// you have to clear it yourself before rendering again,</span>
<span class="comment">// otherwise leftovers of what you&#39;ve renderer before might</span>
<span class="comment">// show up on the window !</span>
<span class="comment">//</span>
<span class="comment">// A good rule of thumb is to `clear()`, draw every texture</span>
<span class="comment">// needed, and then `present()`; repeat this every new frame.</span>
</pre></div>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl&lt;'s&gt; <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;<a class="struct" href="../../sdl2/surface/struct.Surface.html" title="struct sdl2::surface::Surface">Surface</a>&lt;'s&gt;&gt;</code><a href='#impl' class='anchor'></a><a class='srclink' href='../../src/sdl2/render.rs.html#332-383' title='goto source code'>[src]</a></h3><div class='docblock'><p>Methods for the <code>SurfaceCanvas</code>.</p>
</div><div class='impl-items'><h4 id='method.from_surface' class="method"><code id='from_surface.v'>pub fn <a href='#method.from_surface' class='fnname'>from_surface</a>(surface: <a class="struct" href="../../sdl2/surface/struct.Surface.html" title="struct sdl2::surface::Surface">Surface</a>&lt;'s&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#337-351' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a 2D software rendering context for a surface.</p>
<p>This method should only fail if SDL2 is not built with rendering
support, or there's an out-of-memory error.</p>
</div><h4 id='method.surface' class="method"><code id='surface.v'>pub fn <a href='#method.surface' class='fnname'>surface</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../sdl2/surface/struct.SurfaceRef.html" title="struct sdl2::surface::SurfaceRef">SurfaceRef</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#355-357' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets a reference to the associated surface of the Canvas</p>
</div><h4 id='method.surface_mut' class="method"><code id='surface_mut.v'>pub fn <a href='#method.surface_mut' class='fnname'>surface_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="../../sdl2/surface/struct.SurfaceRef.html" title="struct sdl2::surface::SurfaceRef">SurfaceRef</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#361-363' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets a mutable reference to the associated surface of the Canvas</p>
</div><h4 id='method.into_surface' class="method"><code id='into_surface.v'>pub fn <a href='#method.into_surface' class='fnname'>into_surface</a>(self) -&gt; <a class="struct" href="../../sdl2/surface/struct.Surface.html" title="struct sdl2::surface::Surface">Surface</a>&lt;'s&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#367-369' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the associated surface of the Canvas and destroys the Canvas</p>
</div><h4 id='method.texture_creator' class="method"><code id='texture_creator.v'>pub fn <a href='#method.texture_creator' class='fnname'>texture_creator</a>(&amp;self) -&gt; <a class="struct" href="../../sdl2/render/struct.TextureCreator.html" title="struct sdl2::render::TextureCreator">TextureCreator</a>&lt;<a class="struct" href="../../sdl2/surface/struct.SurfaceContext.html" title="struct sdl2::surface::SurfaceContext">SurfaceContext</a>&lt;'s&gt;&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#377-382' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a <code>TextureCreator</code> that can create Textures to be drawn on this <code>Canvas</code></p>
<p>This <code>TextureCreator</code> will share a reference to the renderer and target context.</p>
<p>The target (i.e., <code>Window</code>) will not be destroyed and the SDL_Renderer will not be
destroyed if the <code>TextureCreator</code> is still in scope.</p>
</div></div><h3 id='impl-1' class='impl'><code class='in-band'>impl <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;<a class="struct" href="../../sdl2/video/struct.Window.html" title="struct sdl2::video::Window">Window</a>&gt;</code><a href='#impl-1' class='anchor'></a><a class='srclink' href='../../src/sdl2/render.rs.html#392-428' title='goto source code'>[src]</a></h3><div class='docblock'><p>Methods for the <code>WindowCanvas</code>.</p>
</div><div class='impl-items'><h4 id='method.window' class="method"><code id='window.v'>pub fn <a href='#method.window' class='fnname'>window</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../sdl2/video/struct.Window.html" title="struct sdl2::video::Window">Window</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#395-397' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets a reference to the associated window of the Canvas</p>
</div><h4 id='method.window_mut' class="method"><code id='window_mut.v'>pub fn <a href='#method.window_mut' class='fnname'>window_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="../../sdl2/video/struct.Window.html" title="struct sdl2::video::Window">Window</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#401-403' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets a mutable reference to the associated window of the Canvas</p>
</div><h4 id='method.into_window' class="method"><code id='into_window.v'>pub fn <a href='#method.into_window' class='fnname'>into_window</a>(self) -&gt; <a class="struct" href="../../sdl2/video/struct.Window.html" title="struct sdl2::video::Window">Window</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#407-409' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the associated window of the Canvas and destroys the Canvas</p>
</div><h4 id='method.default_pixel_format' class="method"><code id='default_pixel_format.v'>pub fn <a href='#method.default_pixel_format' class='fnname'>default_pixel_format</a>(&amp;self) -&gt; <a class="enum" href="../../sdl2/pixels/enum.PixelFormatEnum.html" title="enum sdl2::pixels::PixelFormatEnum">PixelFormatEnum</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#412-414' title='goto source code'>[src]</a></h4><h4 id='method.texture_creator-1' class="method"><code id='texture_creator.v-1'>pub fn <a href='#method.texture_creator-1' class='fnname'>texture_creator</a>(&amp;self) -&gt; <a class="struct" href="../../sdl2/render/struct.TextureCreator.html" title="struct sdl2::render::TextureCreator">TextureCreator</a>&lt;<a class="struct" href="../../sdl2/video/struct.WindowContext.html" title="struct sdl2::video::WindowContext">WindowContext</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#422-427' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a <code>TextureCreator</code> that can create Textures to be drawn on this <code>Canvas</code></p>
<p>This <code>TextureCreator</code> will share a reference to the renderer and target context.</p>
<p>The target (i.e., <code>Window</code>) will not be destroyed and the SDL_Renderer will not be
destroyed if the <code>TextureCreator</code> is still in scope.</p>
</div></div><h3 id='impl-2' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../../sdl2/render/trait.RenderTarget.html" title="trait sdl2::render::RenderTarget">RenderTarget</a>&gt; <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt;</code><a href='#impl-2' class='anchor'></a><a class='srclink' href='../../src/sdl2/render.rs.html#430-610' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.render_target_supported' class="method"><code id='render_target_supported.v'>pub fn <a href='#method.render_target_supported' class='fnname'>render_target_supported</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#432-434' title='goto source code'>[src]</a></h4><div class='docblock'><p>Determine whether a window supports the use of render targets.</p>
</div><h4 id='method.with_texture_canvas' class="method"><code id='with_texture_canvas.v'>pub fn <a href='#method.with_texture_canvas' class='fnname'>with_texture_canvas</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;texture: &amp;mut <a class="struct" href="../../sdl2/render/struct.Texture.html" title="struct sdl2::render::Texture">Texture</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="../../sdl2/render/enum.TargetRenderError.html" title="enum sdl2::render::TargetRenderError">TargetRenderError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&amp;'r mut <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt;),&nbsp;</span></code><a class='srclink' href='../../src/sdl2/render.rs.html#501-514' title='goto source code'>[src]</a></h4><div class='docblock'><p>Temporarily sets the target of <code>Canvas</code> to a <code>Texture</code>. This effectively allows rendering
to a <code>Texture</code> in any way you want: you can make a <code>Texture</code> a combination of other
<code>Texture</code>s, be a complex geometry form with the <code>gfx</code> module, ... You can draw pixel by
pixel in it if you want, so you can do basically anything with that <code>Texture</code>.</p>
<p>If you want to set the content of multiple <code>Texture</code> at once the most efficient way
possible, <em>don't</em> make a loop and call this function every time and use
<code>with_multiple_texture_canvas</code> instead. Using <code>with_texture_canvas</code> is actually
inefficient because the target is reset to the source (the <code>Window</code> or the <code>Surface</code>)
at the end of this function, but using it in a loop would make this reset useless.
Plus, the check that render_target is actually supported on that <code>Canvas</code> is also
done every time, leading to useless checks.</p>
<h1 id="notes" class="section-header"><a href="#notes">Notes</a></h1>
<p>Note that the <code>Canvas</code> in the closure is exactly the same as the one you call this
function with, meaning that you can call every function of your original <code>Canvas</code>.</p>
<p>That means you can also call <code>with_texture_canvas</code> and <code>with_multiple_texture_canvas</code> from
the inside of the closure. Even though this is useless and inefficient, this is totally
safe to do and allowed.</p>
<p>Since the render target is now a Texture, some calls of Canvas might return another result
than if the target was to be the original source. For instance <code>output_size</code> will return
this size of the current <code>Texture</code> in the closure, but the size of the <code>Window</code> or
<code>Surface</code> outside of the closure.</p>
<p>You do not need to call <code>present</code> after drawing in the Canvas in the closure, the changes
are applied directly to the <code>Texture</code> instead of a hidden buffer.</p>
<h1 id="errors" class="section-header"><a href="#errors">Errors</a></h1>
<ul>
<li>returns <code>TargetRenderError::NotSupported</code>
if the renderer does not support the use of render targets</li>
<li>returns <code>TargetRenderError::SdlError</code> if SDL2 returned with an error code.</li>
</ul>
<p>The texture <em>must</em> be created with the texture access:
<code>sdl2::render::TextureAccess::Target</code>.
Using a texture which was not created with the texture access <code>Target</code> is undefined
behavior.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<p>The example below changes a newly created <code>Texture</code> to be a 150-by-150 black texture with a
50-by-50 red square in the middle.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">texture_creator</span> <span class="op">=</span> <span class="ident">canvas</span>.<span class="ident">texture_creator</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">texture</span> <span class="op">=</span> <span class="ident">texture_creator</span>
.<span class="ident">create_texture_target</span>(<span class="ident">texture_creator</span>.<span class="ident">default_pixel_format</span>(), <span class="number">150</span>, <span class="number">150</span>)
.<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">canvas</span>.<span class="ident">with_texture_canvas</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">texture</span>, <span class="op">|</span><span class="ident">texture_canvas</span><span class="op">|</span> {
<span class="ident">texture_canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGBA</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">255</span>));
<span class="ident">texture_canvas</span>.<span class="ident">clear</span>();
<span class="ident">texture_canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGBA</span>(<span class="number">255</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">255</span>));
<span class="ident">texture_canvas</span>.<span class="ident">fill_rect</span>(<span class="ident">Rect</span>::<span class="ident">new</span>(<span class="number">50</span>, <span class="number">50</span>, <span class="number">50</span>, <span class="number">50</span>)).<span class="ident">unwrap</span>();
});</pre></div>
</div><h4 id='method.with_multiple_texture_canvas' class="method"><code id='with_multiple_texture_canvas.v'>pub fn <a href='#method.with_multiple_texture_canvas' class='fnname'>with_multiple_texture_canvas</a>&lt;'t: 'a, 'a: 's, 's, I, F, U:&nbsp;'s&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;textures: I, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="../../sdl2/render/enum.TargetRenderError.html" title="enum sdl2::render::TargetRenderError">TargetRenderError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;'r mut <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>U),<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;'s <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>&amp;'a mut <a class="struct" href="../../sdl2/render/struct.Texture.html" title="struct sdl2::render::Texture">Texture</a>&lt;'t&gt;, U<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;,&nbsp;</span></code><a class='srclink' href='../../src/sdl2/render.rs.html#573-590' title='goto source code'>[src]</a></h4><div class='docblock'><p>Same as <code>with_texture_canvas</code>, but allows to change multiple <code>Texture</code>s at once with the
least amount of overhead. It means that between every iteration the Target is not reset to
the source, and that the fact that the Canvas supports render target isn't checked every
iteration either; the check is actually only done once, at the beginning, avoiding useless
checks.</p>
<p>The closure is run once for every <code>Texture</code> sent as parameter.</p>
<p>The main changes from <code>with_texture_canvas</code> is that is takes an <code>Iterator</code> of <code>(&amp;mut Texture, U)</code>, where U is a type defined by the user. The closure takes a <code>&amp;mut Canvas</code>, and
<code>&amp;U</code> as arguments instead of a simple <code>&amp;mut Canvas</code>. This user-defined type allows you to
keep track of what to do with the Canvas you have received in the closure.</p>
<p>You will usually want to keep track of the number, a property, or anything that will allow
you to uniquely track this <code>Texture</code>, but it can also be an empty struct or <code>()</code> as well!</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<p>Let's create two textures, one which will be yellow, and the other will be white</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">texture_creator</span> <span class="op">=</span> <span class="ident">canvas</span>.<span class="ident">texture_creator</span>();
<span class="kw">enum</span> <span class="ident">TextureColor</span> {
<span class="ident">Yellow</span>,
<span class="ident">White</span>,
};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">square_texture1</span> : <span class="ident">Texture</span> <span class="op">=</span>
<span class="ident">texture_creator</span>.<span class="ident">create_texture_target</span>(<span class="prelude-val">None</span>, <span class="number">100</span>, <span class="number">100</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">square_texture2</span> : <span class="ident">Texture</span> <span class="op">=</span>
<span class="ident">texture_creator</span>.<span class="ident">create_texture_target</span>(<span class="prelude-val">None</span>, <span class="number">100</span>, <span class="number">100</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">textures</span> : <span class="ident">Vec</span><span class="op">&lt;</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Texture</span>, <span class="ident">TextureColor</span>)<span class="op">&gt;</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[
(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">square_texture1</span>, <span class="ident">TextureColor</span>::<span class="ident">Yellow</span>),
(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">square_texture2</span>, <span class="ident">TextureColor</span>::<span class="ident">White</span>)
];
<span class="kw">let</span> <span class="ident">result</span> : <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span>
<span class="ident">canvas</span>.<span class="ident">with_multiple_texture_canvas</span>(<span class="ident">textures</span>.<span class="ident">iter</span>(), <span class="op">|</span><span class="ident">texture_canvas</span>, <span class="ident">user_context</span><span class="op">|</span> {
<span class="kw">match</span> <span class="kw-2">*</span><span class="ident">user_context</span> {
<span class="ident">TextureColor</span>::<span class="ident">White</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">texture_canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGB</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">255</span>));
},
<span class="ident">TextureColor</span>::<span class="ident">Yellow</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">texture_canvas</span>.<span class="ident">set_draw_color</span>(<span class="ident">Color</span>::<span class="ident">RGB</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">0</span>));
}
};
<span class="ident">texture_canvas</span>.<span class="ident">clear</span>();
});
<span class="comment">// square_texture1 is now Yellow and square_texture2 is now White!</span></pre></div>
</div></div><h3 id='impl-3' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../../sdl2/render/trait.RenderTarget.html" title="trait sdl2::render::RenderTarget">RenderTarget</a>&gt; <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt;</code><a href='#impl-3' class='anchor'></a><a class='srclink' href='../../src/sdl2/render.rs.html#924-1468' title='goto source code'>[src]</a></h3><div class='docblock'><p>Drawing methods</p>
</div><div class='impl-items'><h4 id='method.raw' class="method"><code id='raw.v'>pub fn <a href='#method.raw' class='fnname'>raw</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../sdl2_sys/struct.SDL_Renderer.html" title="struct sdl2_sys::SDL_Renderer">SDL_Renderer</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#925-927' title='goto source code'>[src]</a></h4><h4 id='method.set_draw_color' class="method"><code id='set_draw_color.v'>pub fn <a href='#method.set_draw_color' class='fnname'>set_draw_color</a>&lt;C:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../sdl2/pixels/struct.Color.html" title="struct sdl2::pixels::Color">Color</a>&gt;&gt;(&amp;mut self, color: C)</code><a class='srclink' href='../../src/sdl2/render.rs.html#930-937' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the color used for drawing operations (Rect, Line and Clear).</p>
</div><h4 id='method.draw_color' class="method"><code id='draw_color.v'>pub fn <a href='#method.draw_color' class='fnname'>draw_color</a>(&amp;self) -&gt; <a class="struct" href="../../sdl2/pixels/struct.Color.html" title="struct sdl2::pixels::Color">Color</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#940-950' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the color used for drawing operations (Rect, Line and Clear).</p>
</div><h4 id='method.set_blend_mode' class="method"><code id='set_blend_mode.v'>pub fn <a href='#method.set_blend_mode' class='fnname'>set_blend_mode</a>(&amp;mut self, blend: <a class="enum" href="../../sdl2/render/enum.BlendMode.html" title="enum sdl2::render::BlendMode">BlendMode</a>)</code><a class='srclink' href='../../src/sdl2/render.rs.html#953-961' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the blend mode used for drawing operations (Fill and Line).</p>
</div><h4 id='method.blend_mode' class="method"><code id='blend_mode.v'>pub fn <a href='#method.blend_mode' class='fnname'>blend_mode</a>(&amp;self) -&gt; <a class="enum" href="../../sdl2/render/enum.BlendMode.html" title="enum sdl2::render::BlendMode">BlendMode</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#964-974' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the blend mode used for drawing operations.</p>
</div><h4 id='method.clear' class="method"><code id='clear.v'>pub fn <a href='#method.clear' class='fnname'>clear</a>(&amp;mut self)</code><a class='srclink' href='../../src/sdl2/render.rs.html#977-982' title='goto source code'>[src]</a></h4><div class='docblock'><p>Clears the current rendering target with the drawing color.</p>
</div><h4 id='method.present' class="method"><code id='present.v'>pub fn <a href='#method.present' class='fnname'>present</a>(&amp;mut self)</code><a class='srclink' href='../../src/sdl2/render.rs.html#991-993' title='goto source code'>[src]</a></h4><div class='docblock'><p>Updates the screen with any rendering performed since the previous call.</p>
<p>SDL's rendering functions operate on a backbuffer; that is, calling a
rendering function such as <code>draw_line()</code> 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.</p>
</div><h4 id='method.output_size' class="method"><code id='output_size.v'>pub fn <a href='#method.output_size' class='fnname'>output_size</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#996-1008' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the output size of a rendering context.</p>
</div><h4 id='method.set_logical_size' class="method"><code id='set_logical_size.v'>pub fn <a href='#method.set_logical_size' class='fnname'>set_logical_size</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="../../sdl2/enum.IntegerOrSdlError.html" title="enum sdl2::IntegerOrSdlError">IntegerOrSdlError</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1011-1020' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a device independent resolution for rendering.</p>
</div><h4 id='method.logical_size' class="method"><code id='logical_size.v'>pub fn <a href='#method.logical_size' class='fnname'>logical_size</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#1023-1030' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets device independent resolution for rendering.</p>
</div><h4 id='method.set_viewport' class="method"><code id='set_viewport.v'>pub fn <a href='#method.set_viewport' class='fnname'>set_viewport</a>&lt;R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;&gt;(&amp;mut self, rect: R)</code><a class='srclink' href='../../src/sdl2/render.rs.html#1033-1042' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the drawing area for rendering on the current target.</p>
</div><h4 id='method.viewport' class="method"><code id='viewport.v'>pub fn <a href='#method.viewport' class='fnname'>viewport</a>(&amp;self) -&gt; <a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#1045-1050' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the drawing area for the current target.</p>
</div><h4 id='method.set_clip_rect' class="method"><code id='set_clip_rect.v'>pub fn <a href='#method.set_clip_rect' class='fnname'>set_clip_rect</a>&lt;R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;&gt;(&amp;mut self, rect: R)</code><a class='srclink' href='../../src/sdl2/render.rs.html#1055-1066' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the clip rectangle for rendering on the specified target.</p>
<p>If the rectangle is <code>None</code>, clipping will be disabled.</p>
</div><h4 id='method.clip_rect' class="method"><code id='clip_rect.v'>pub fn <a href='#method.clip_rect' class='fnname'>clip_rect</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1071-1080' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the clip rectangle for the current target.</p>
<p>Returns <code>None</code> if clipping is disabled.</p>
</div><h4 id='method.set_scale' class="method"><code id='set_scale.v'>pub fn <a href='#method.set_scale' class='fnname'>set_scale</a>(&amp;mut self, scale_x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>, scale_y: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1083-1087' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the drawing scale for rendering on the current target.</p>
</div><h4 id='method.scale' class="method"><code id='scale.v'>pub fn <a href='#method.scale' class='fnname'>scale</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#1090-1095' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the drawing scale for the current target.</p>
</div><h4 id='method.draw_point' class="method"><code id='draw_point.v'>pub fn <a href='#method.draw_point' class='fnname'>draw_point</a>&lt;P:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a>&gt;&gt;(&amp;mut self, point: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1099-1107' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws a point on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.draw_points' class="method"><code id='draw_points.v'>pub fn <a href='#method.draw_points' class='fnname'>draw_points</a>&lt;'a, P:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;points: P<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1111-1123' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws multiple points on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.draw_line' class="method"><code id='draw_line.v'>pub fn <a href='#method.draw_line' class='fnname'>draw_line</a>&lt;P1:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a>&gt;, P2:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a>&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;start: P1, <br>&nbsp;&nbsp;&nbsp;&nbsp;end: P2<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1127-1141' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws a line on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.draw_lines' class="method"><code id='draw_lines.v'>pub fn <a href='#method.draw_lines' class='fnname'>draw_lines</a>&lt;'a, P:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;points: P<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1145-1157' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws a series of connected lines on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.draw_rect' class="method"><code id='draw_rect.v'>pub fn <a href='#method.draw_rect' class='fnname'>draw_rect</a>(&amp;mut self, rect: <a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1161-1168' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws a rectangle on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.draw_rects' class="method"><code id='draw_rects.v'>pub fn <a href='#method.draw_rects' class='fnname'>draw_rects</a>(&amp;mut self, rects: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1172-1183' title='goto source code'>[src]</a></h4><div class='docblock'><p>Draws some number of rectangles on the current rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.fill_rect' class="method"><code id='fill_rect.v'>pub fn <a href='#method.fill_rect' class='fnname'>fill_rect</a>&lt;R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;rect: R<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1189-1202' title='goto source code'>[src]</a></h4><div class='docblock'><p>Fills a rectangle on the current rendering target with the drawing
color.
Passing None will fill the entire rendering target.
Errors if drawing fails for any reason (e.g. driver failure)</p>
</div><h4 id='method.fill_rects' class="method"><code id='fill_rects.v'>pub fn <a href='#method.fill_rects' class='fnname'>fill_rects</a>(&amp;mut self, rects: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1207-1218' title='goto source code'>[src]</a></h4><div class='docblock'><p>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)</p>
</div><h4 id='method.copy' class="method"><code id='copy.v'>pub fn <a href='#method.copy' class='fnname'>copy</a>&lt;R1, R2&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;texture: &amp;<a class="struct" href="../../sdl2/render/struct.Texture.html" title="struct sdl2::render::Texture">Texture</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;src: R1, <br>&nbsp;&nbsp;&nbsp;&nbsp;dst: R2<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R1: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R2: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;,&nbsp;</span></code><a class='srclink' href='../../src/sdl2/render.rs.html#1228-1246' title='goto source code'>[src]</a></h4><div class='docblock'><p>Copies a portion of the texture to the current rendering target.</p>
<ul>
<li>If <code>src</code> is <code>None</code>, the entire texture is copied.</li>
<li>If <code>dst</code> is <code>None</code>, the texture will be stretched to fill the given
rectangle.</li>
</ul>
<p>Errors if drawing fails for any reason (e.g. driver failure),
or if the provided texture does not belong to the renderer.</p>
</div><h4 id='method.copy_ex' class="method"><code id='copy_ex.v'>pub fn <a href='#method.copy_ex' class='fnname'>copy_ex</a>&lt;R1, R2, P&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;texture: &amp;<a class="struct" href="../../sdl2/render/struct.Texture.html" title="struct sdl2::render::Texture">Texture</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;src: R1, <br>&nbsp;&nbsp;&nbsp;&nbsp;dst: R2, <br>&nbsp;&nbsp;&nbsp;&nbsp;angle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;center: P, <br>&nbsp;&nbsp;&nbsp;&nbsp;flip_horizontal: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flip_vertical: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R1: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R2: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Point.html" title="struct sdl2::rect::Point">Point</a>&gt;&gt;,&nbsp;</span></code><a class='srclink' href='../../src/sdl2/render.rs.html#1261-1305' title='goto source code'>[src]</a></h4><div class='docblock'><p>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.</p>
<ul>
<li>If <code>src</code> is <code>None</code>, the entire texture is copied.</li>
<li>If <code>dst</code> is <code>None</code>, the texture will be stretched to fill the given
rectangle.</li>
<li>If <code>center</code> is <code>None</code>, rotation will be done around the center point
of <code>dst</code>, or <code>src</code> if <code>dst</code> is None.</li>
</ul>
<p>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.</p>
</div><h4 id='method.read_pixels' class="method"><code id='read_pixels.v'>pub fn <a href='#method.read_pixels' class='fnname'>read_pixels</a>&lt;R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../sdl2/rect/struct.Rect.html" title="struct sdl2::rect::Rect">Rect</a>&gt;&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;rect: R, <br>&nbsp;&nbsp;&nbsp;&nbsp;format: <a class="enum" href="../../sdl2/pixels/enum.PixelFormatEnum.html" title="enum sdl2::pixels::PixelFormatEnum">PixelFormatEnum</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#1310-1344' title='goto source code'>[src]</a></h4><div class='docblock'><p>Reads pixels from the current rendering target.</p>
<h1 id="remarks" class="section-header"><a href="#remarks">Remarks</a></h1>
<p>WARNING: This is a very slow operation, and should not be used frequently.</p>
</div></div><h2 id='deref-methods' class='small-section-header'>Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = <a class="struct" href="../../sdl2/render/struct.RendererContext.html" title="struct sdl2::render::RendererContext">RendererContext</a>&lt;T::<a class="type" href="../../sdl2/render/trait.RenderTarget.html#associatedtype.Context" title="type sdl2::render::RenderTarget::Context">Context</a>&gt;&gt;<a href='#deref-methods' class='anchor'></a></h2><div class='impl-items'><h4 id='method.info' class="method"><code id='info.v'>pub fn <a href='#method.info' class='fnname'>info</a>(&amp;self) -&gt; <a class="struct" href="../../sdl2/render/struct.RendererInfo.html" title="struct sdl2::render::RendererInfo">RendererInfo</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#206-219' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets information about the rendering context.</p>
</div><h4 id='method.raw-1' class="method"><code id='raw.v-1'>pub fn <a href='#method.raw-1' class='fnname'>raw</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../sdl2_sys/struct.SDL_Renderer.html" title="struct sdl2_sys::SDL_Renderer">SDL_Renderer</a></code><a class='srclink' href='../../src/sdl2/render.rs.html#222-224' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets the raw pointer to the SDL_Renderer</p>
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Deref' class='impl'><code class='in-band'>impl&lt;T:&nbsp;<a class="trait" href="../../sdl2/render/trait.RenderTarget.html" title="trait sdl2::render::RenderTarget">RenderTarget</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt;</code><a href='#impl-Deref' class='anchor'></a><a class='srclink' href='../../src/sdl2/render.rs.html#246-252' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Target' class="type"><code id='Target.t'>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = <a class="struct" href="../../sdl2/render/struct.RendererContext.html" title="struct sdl2::render::RendererContext">RendererContext</a>&lt;T::<a class="type" href="../../sdl2/render/trait.RenderTarget.html#associatedtype.Context" title="type sdl2::render::RenderTarget::Context">Context</a>&gt;</code></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id='method.deref' class="method hidden"><code id='deref.v'>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../sdl2/render/struct.RendererContext.html" title="struct sdl2::render::RendererContext">RendererContext</a>&lt;T::<a class="type" href="../../sdl2/render/trait.RenderTarget.html#associatedtype.Context" title="type sdl2::render::RenderTarget::Context">Context</a>&gt;</code><a class='srclink' href='../../src/sdl2/render.rs.html#249-251' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</p>
</div></div><h3 id='impl-DrawRenderer' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="../../sdl2/gfx/primitives/trait.DrawRenderer.html" title="trait sdl2::gfx::primitives::DrawRenderer">DrawRenderer</a> for <a class="struct" href="../../sdl2/render/struct.Canvas.html" title="struct sdl2::render::Canvas">Canvas</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../sdl2/render/trait.RenderTarget.html" title="trait sdl2::render::RenderTarget">RenderTarget</a>,&nbsp;</span></code><a href='#impl-DrawRenderer' class='anchor'></a><a class='srclink' href='../../src/sdl2/gfx/primitives.rs.html#205-456' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.pixel' class="method hidden"><code id='pixel.v'>fn <a href='../../sdl2/gfx/primitives/trait.DrawRenderer.html#tymethod.pixel' class='fnname'>pixel</a>&lt;C:&nbsp;<a class="trait" href="../../sdl2/gfx/primitives/trait.ToColor.html" title="trait sdl2::gfx::primitives::ToColor">ToColor</a>&gt;(&amp;self, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, y: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, color: C) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/gfx/primitives.rs.html#206-209' title='goto source code'>[src]</a></h4><h4 id='method.hline' class="method hidden"><code id='hline.v'>fn <a href='../../sdl2/gfx/primitives/trait.DrawRenderer.html#tymethod.hline' class='fnname'>hline</a>&lt;C:&nbsp;<a class="trait" href="../../sdl2/gfx/primitives/trait.ToColor.html" title="trait sdl2::gfx::primitives::ToColor">ToColor</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;x1: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;x2: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;y: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;color: C<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code><a class='srclink' href='../../src/sdl2/gfx/primitives.rs.html#210-213' title='goto source code'>[src]</a></h4><h4 id='method.vline' class="method hidden"><code id='vline.v'>fn <a href='../../sdl2/gfx/primitives/trait.DrawRenderer.html#tymethod.vline' class='fnname'>vline</a>&lt;C:&nbsp;<a class="trait" href="../../sdl2/gfx/primitives/trait.ToColor.html" title="trait sdl2::gfx::primitives::ToColor">ToColor</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;y1: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;y2: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;color: C<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/stru
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-569' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#566-568' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#554-561' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#558-560' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#602-611' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#608-610' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588-597' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#594-596' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "sdl2";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>