Skip to main content

RenderCtx

Struct RenderCtx 

Source
pub struct RenderCtx<'a, D>
where D: DrawTarget<Color = Rgb565>,
{ /* private fields */ }

Implementations§

Source§

impl<'a, D> RenderCtx<'a, D>
where D: DrawTarget<Color = Rgb565>,

Source

pub fn new(target: &'a mut D, viewport: Rect) -> Self

Source

pub fn with_dirty(target: &'a mut D, viewport: Rect, dirty: Rect) -> Self

Source

pub const fn clip(&self) -> Rect

Source

pub fn set_clip(&mut self, clip: Rect)

Source

pub const fn quality(&self) -> RenderQuality

Source

pub fn set_quality(&mut self, quality: RenderQuality)

Source

pub const fn backend_caps(&self) -> RenderBackendCaps

Source

pub fn set_backend_caps(&mut self, caps: RenderBackendCaps)

Source

pub fn push_transform(&mut self, transform: Transform2D)

Source

pub fn pop_transform(&mut self)

Source

pub fn translate(&mut self, x: f32, y: f32)

Source

pub fn scale(&mut self, x: f32, y: f32)

Source

pub fn rotate(&mut self, deg: f32)

Source

pub fn skew(&mut self, x_deg: f32, y_deg: f32)

Source

pub fn push_layer(&mut self, layer: LayerState)

Source

pub fn pop_layer(&mut self)

Source

pub const fn shadow_spread_for(&self, spread: u8) -> u8

Source

pub fn fill_rect(&mut self, rect: Rect, color: Rgb565) -> Result<(), D::Error>

Source

pub fn fill_rect_alpha( &mut self, rect: Rect, color: Rgb565, opacity: u8, ) -> Result<(), D::Error>

Source

pub fn fill_rounded_rect( &mut self, rect: Rect, radius: u8, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn fill_rounded_rect_alpha( &mut self, rect: Rect, radius: u8, color: Rgb565, opacity: u8, ) -> Result<(), D::Error>

Source

pub fn fill_rounded_rect_gradient_alpha( &mut self, rect: Rect, radius: u8, gradient: LinearGradient, opacity: u8, ) -> Result<(), D::Error>

Source

pub fn stroke_rect( &mut self, rect: Rect, border: Border, ) -> Result<(), D::Error>

Source

pub fn stroke_rect_alpha( &mut self, rect: Rect, border: Border, opacity: u8, ) -> Result<(), D::Error>

Source

pub fn stroke_rounded_rect( &mut self, rect: Rect, radius: u8, border: Border, ) -> Result<(), D::Error>

Source

pub fn stroke_rounded_rect_alpha( &mut self, rect: Rect, radius: u8, border: Border, opacity: u8, ) -> Result<(), D::Error>

Source

pub fn draw_text( &mut self, x: i32, y: i32, text: &str, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn draw_text_with_font( &mut self, x: i32, y: i32, text: &str, color: Rgb565, font: FontId, ) -> Result<(), D::Error>

Source

pub fn draw_text_in( &mut self, rect: Rect, text: &str, style: TextStyle, ) -> Result<(), D::Error>

Source

pub fn draw_text_shaped_in<S, const N: usize>( &mut self, rect: Rect, text: &str, style: TextStyle, shaper: &S, config: ShapingConfig, ) -> Result<(), D::Error>
where S: TextShaper,

Source

pub fn draw_text_in_with_font( &mut self, rect: Rect, text: &str, style: TextStyle, font: FontId, ) -> Result<(), D::Error>

Source

pub fn draw_line_in( &mut self, rect: Rect, line: Line<'_>, ) -> Result<(), D::Error>

Source

pub fn draw_line( &mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn draw_line_styled( &mut self, x0: i32, y0: i32, x1: i32, y1: i32, style: StrokeStyle, ) -> Result<(), D::Error>

Source

pub fn fill_circle( &mut self, center_x: i32, center_y: i32, radius: u32, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn stroke_circle( &mut self, center_x: i32, center_y: i32, radius: u32, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn stroke_arc( &mut self, center_x: i32, center_y: i32, radius: u32, start_deg: i32, end_deg: i32, color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn stroke_arc_styled( &mut self, center_x: i32, center_y: i32, radius: u32, start_deg: i32, end_deg: i32, style: StrokeStyle, ) -> Result<(), D::Error>

Source

pub fn fill_sector_sweep( &mut self, center_x: i32, center_y: i32, radius: u32, start_deg: f32, sweep_deg: f32, color: Rgb565, ) -> Result<(), D::Error>

Fill a sector (“pie slice”) using a start angle and sweep angle in degrees.

Positive sweep draws counterclockwise, negative sweep clockwise.

Source

pub fn fill_polygon( &mut self, points: &[Point], color: Rgb565, ) -> Result<(), D::Error>

Source

pub fn draw_image( &mut self, rect: Rect, image: ImageRef<'_>, fit: ImageFit, ) -> Result<(), D::Error>

Source

pub fn draw_image_region( &mut self, rect: Rect, image: ImageRef<'_>, fit: ImageFit, src_rect: Rect, ) -> Result<(), D::Error>

Source

pub fn draw_image_transformed( &mut self, rect: Rect, image: ImageRef<'_>, scale: f32, rotation_deg: f32, ) -> Result<(), D::Error>

Source

pub fn fill_rect_masked( &mut self, rect: Rect, color: Rgb565, mask: fn(i32, i32) -> bool, ) -> Result<(), D::Error>

Source

pub fn draw_text_model_in( &mut self, rect: Rect, text: Text<'_>, ) -> Result<(), D::Error>

Source

pub fn text_metrics(text: &str) -> TextMetrics

Source

pub fn text_metrics_with_font(text: &str, font: FontId) -> TextMetrics

Source

pub fn text_metrics_wrapped( text: &str, max_width: u32, wrap: TextWrap, ) -> TextMetrics

Source

pub fn text_metrics_wrapped_with_font( text: &str, max_width: u32, wrap: TextWrap, font: FontId, ) -> TextMetrics

Auto Trait Implementations§

§

impl<'a, D> !UnwindSafe for RenderCtx<'a, D>

§

impl<'a, D> Freeze for RenderCtx<'a, D>

§

impl<'a, D> RefUnwindSafe for RenderCtx<'a, D>
where D: RefUnwindSafe,

§

impl<'a, D> Send for RenderCtx<'a, D>
where D: Send,

§

impl<'a, D> Sync for RenderCtx<'a, D>
where D: Sync,

§

impl<'a, D> Unpin for RenderCtx<'a, D>

§

impl<'a, D> UnsafeUnpin for RenderCtx<'a, D>

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

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

Source§

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>,

Source§

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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.