pub struct Renderer<'window> { /* private fields */ }
Expand description

A SDL2 renderer. This is often used for rendering with pen::Pen.

Implementations§

source§

impl<'window> Renderer<'window>

source

pub fn new(window: &'window Window<'_>) -> Self

Constructs a renderer from the window.

source

pub fn window(&self) -> &Window<'_>

Returns the borrowing window.

source

pub fn output_size(&self) -> Result<Size>

Returns the geometry size of the output from the renderer.

source

pub fn clip(&'window mut self, area: Rect) -> ClippedRenderer<'window>

Clips the renderer by area.

source

pub fn logical_size(&self) -> Option<Size>

Returns the logical size of the renderer if available.

source

pub fn set_logical_size(&self, _: Size)

Sets the logical size of the renderer.

source

pub fn is_forced_integer_scale(&self) -> bool

Returns whether integer scaled is forced.

source

pub fn force_integer_scale(&self, enabled: bool)

Sets whether integer scaled is forced.

source

pub fn scale(&self) -> Scale

Returns the scale of th renderer.

source

pub fn set_scale(&self, _: Scale)

Sets the scale of the renderer.

source

pub fn viewport(&self) -> Rect

Returns the viewport rectangle of the renderer.

source

pub fn set_viewport(&self, area: Option<Rect>)

Sets the viewport rectangle of the renderer.

source

pub fn set_target<'texture: 'window>( &'window self, texture: &'texture Texture<'_> )

Sets the render target to the texture.

source

pub fn set_target_default(&self)

Resets the render target to the original window.

Trait Implementations§

source§

impl Debug for Renderer<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'window> Drop for Renderer<'window>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'window> RendererInfoExt for Renderer<'window>

source§

fn renderer_info(&self) -> RendererInfo

Returns the information of the renderer.

Auto Trait Implementations§

§

impl<'window> !RefUnwindSafe for Renderer<'window>

§

impl<'window> !Send for Renderer<'window>

§

impl<'window> !Sync for Renderer<'window>

§

impl<'window> Unpin for Renderer<'window>

§

impl<'window> !UnwindSafe for Renderer<'window>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.