pub struct RenderCtx<'a, D, C = Dither>where
D: DrawTarget<Color = Rgb565>,{ /* private fields */ }Implementations§
Source§impl<'a, D> RenderCtx<'a, D, Blend>
impl<'a, D> RenderCtx<'a, D, Blend>
Sourcepub fn compositing(target: &'a mut D, viewport: Rect) -> Self
pub fn compositing(target: &'a mut D, viewport: Rect) -> Self
Like RenderCtx::new, but every drawing call alpha-composites against
the target’s current contents (true blending) instead of dithering.
Requires a readback-capable target (PixelRead), e.g. a
Framebuffer.
Sourcepub fn blur_rect(&mut self, rect: Rect, blur_degree: u8) -> Result<(), D::Error>
pub fn blur_rect(&mut self, rect: Rect, blur_degree: u8) -> Result<(), D::Error>
Apply Fast IIR Blur to a sub-region rect on the destination target.
Sourcepub fn reverse_colour_rect(&mut self, rect: Rect) -> Result<(), D::Error>
pub fn reverse_colour_rect(&mut self, rect: Rect) -> Result<(), D::Error>
Apply reverse colour (color inversion) filter on rect (PixelRead target).
Source§impl<'a, D, C> RenderCtx<'a, D, C>
impl<'a, D, C> RenderCtx<'a, D, C>
pub const fn clip(&self) -> Rect
pub fn set_clip(&mut self, clip: Rect)
pub const fn quality(&self) -> RenderQuality
pub fn set_quality(&mut self, quality: RenderQuality)
pub const fn backend_caps(&self) -> RenderBackendCaps
pub fn set_backend_caps(&mut self, caps: RenderBackendCaps)
pub fn push_transform(&mut self, transform: Transform2D)
pub fn pop_transform(&mut self)
pub fn translate(&mut self, x: f32, y: f32)
pub fn scale(&mut self, x: f32, y: f32)
pub fn rotate(&mut self, deg: f32)
pub fn skew(&mut self, x_deg: f32, y_deg: f32)
pub fn push_layer(&mut self, layer: LayerState)
pub fn pop_layer(&mut self)
pub const fn shadow_spread_for(&self, spread: u8) -> u8
pub fn fill_rect(&mut self, rect: Rect, color: Rgb565) -> Result<(), D::Error>
pub fn fill_rect_alpha( &mut self, rect: Rect, color: Rgb565, opacity: u8, ) -> Result<(), D::Error>
pub fn fill_rounded_rect( &mut self, rect: Rect, radius: u8, color: Rgb565, ) -> Result<(), D::Error>
pub fn fill_rounded_rect_alpha( &mut self, rect: Rect, radius: u8, color: Rgb565, opacity: u8, ) -> Result<(), D::Error>
pub fn fill_rounded_rect_gradient_alpha( &mut self, rect: Rect, radius: u8, gradient: LinearGradient, opacity: u8, ) -> Result<(), D::Error>
pub fn stroke_rect( &mut self, rect: Rect, border: Border, ) -> Result<(), D::Error>
pub fn stroke_rect_alpha( &mut self, rect: Rect, border: Border, opacity: u8, ) -> Result<(), D::Error>
pub fn stroke_rounded_rect( &mut self, rect: Rect, radius: u8, border: Border, ) -> Result<(), D::Error>
pub fn stroke_rounded_rect_alpha( &mut self, rect: Rect, radius: u8, border: Border, opacity: u8, ) -> Result<(), D::Error>
pub fn draw_text( &mut self, x: i32, y: i32, text: &str, color: Rgb565, ) -> Result<(), D::Error>
pub fn draw_text_with_font( &mut self, x: i32, y: i32, text: &str, color: Rgb565, font: FontId, ) -> Result<(), D::Error>
pub fn draw_text_in( &mut self, rect: Rect, text: &str, style: TextStyle, ) -> Result<(), D::Error>
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,
pub fn draw_text_in_with_font( &mut self, rect: Rect, text: &str, style: TextStyle, font: FontId, ) -> Result<(), D::Error>
pub fn draw_line_in( &mut self, rect: Rect, line: Line<'_>, ) -> Result<(), D::Error>
pub fn draw_line( &mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: Rgb565, ) -> Result<(), D::Error>
pub fn draw_line_styled( &mut self, x0: i32, y0: i32, x1: i32, y1: i32, style: StrokeStyle, ) -> Result<(), D::Error>
pub fn fill_circle( &mut self, center_x: i32, center_y: i32, radius: u32, color: Rgb565, ) -> Result<(), D::Error>
pub fn stroke_circle( &mut self, center_x: i32, center_y: i32, radius: u32, color: Rgb565, ) -> Result<(), D::Error>
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>
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>
Sourcepub 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>
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.
pub fn fill_polygon( &mut self, points: &[Point], color: Rgb565, ) -> Result<(), D::Error>
pub fn draw_image( &mut self, rect: Rect, image: ImageRef<'_>, fit: ImageFit, ) -> Result<(), D::Error>
pub fn draw_image_region( &mut self, rect: Rect, image: ImageRef<'_>, fit: ImageFit, src_rect: Rect, ) -> Result<(), D::Error>
pub fn draw_image_transformed( &mut self, rect: Rect, image: ImageRef<'_>, scale: f32, rotation_deg: f32, ) -> Result<(), D::Error>
pub fn fill_rect_masked( &mut self, rect: Rect, color: Rgb565, mask: fn(i32, i32) -> bool, ) -> Result<(), D::Error>
pub fn draw_text_model_in( &mut self, rect: Rect, text: Text<'_>, ) -> Result<(), D::Error>
pub fn text_metrics(text: &str) -> TextMetrics
pub fn text_metrics_with_font(text: &str, font: FontId) -> TextMetrics
pub fn text_metrics_wrapped( text: &str, max_width: u32, wrap: TextWrap, ) -> TextMetrics
pub fn text_metrics_wrapped_with_font( text: &str, max_width: u32, wrap: TextWrap, font: FontId, ) -> TextMetrics
Source§impl<'a, D, C> RenderCtx<'a, D, C>
impl<'a, D, C> RenderCtx<'a, D, C>
Sourcepub fn fill_rect_true_alpha(
&mut self,
rect: Rect,
color: Rgb565,
alpha: u8,
) -> Result<(), D::Error>
pub fn fill_rect_true_alpha( &mut self, rect: Rect, color: Rgb565, alpha: u8, ) -> Result<(), D::Error>
Like RenderCtx::fill_rect_alpha, but alpha-composites against the
destination’s real current pixels instead of dithering.
Sourcepub fn fill_rounded_rect_true_alpha(
&mut self,
rect: Rect,
radius: u8,
color: Rgb565,
alpha: u8,
) -> Result<(), D::Error>
pub fn fill_rounded_rect_true_alpha( &mut self, rect: Rect, radius: u8, color: Rgb565, alpha: u8, ) -> Result<(), D::Error>
Like RenderCtx::fill_rounded_rect_alpha, but alpha-composites
against the destination’s real current pixels instead of dithering.
Sourcepub fn fill_rect_alpha_mask(
&mut self,
rect: Rect,
mask: &[u8],
mask_stride: usize,
color: Rgb565,
opacity: u8,
) -> Result<(), D::Error>
pub fn fill_rect_alpha_mask( &mut self, rect: Rect, mask: &[u8], mask_stride: usize, color: Rgb565, opacity: u8, ) -> Result<(), D::Error>
Fill a rectangle with an 8-bit alpha mask and solid color.
Sourcepub fn fill_rounded_rect_alpha_gradient(
&mut self,
rect: Rect,
radius: u8,
gradient: &AlphaLinearGradient,
opacity: u8,
) -> Result<(), D::Error>
pub fn fill_rounded_rect_alpha_gradient( &mut self, rect: Rect, radius: u8, gradient: &AlphaLinearGradient, opacity: u8, ) -> Result<(), D::Error>
Fill a rounded rectangle with an AlphaLinearGradient.
Sourcepub fn fill_rounded_rect_radial_gradient(
&mut self,
rect: Rect,
radius: u8,
gradient: &AlphaRadialGradient,
opacity: u8,
) -> Result<(), D::Error>
pub fn fill_rounded_rect_radial_gradient( &mut self, rect: Rect, radius: u8, gradient: &AlphaRadialGradient, opacity: u8, ) -> Result<(), D::Error>
Fill a rounded rectangle with an AlphaRadialGradient.
Sourcepub fn draw_drop_shadow(
&mut self,
rect: Rect,
_radius: u8,
shadow_color: Rgb565,
shadow_opacity: u8,
shadow_spread: u8,
blur_radius: u8,
) -> Result<(), D::Error>
pub fn draw_drop_shadow( &mut self, rect: Rect, _radius: u8, shadow_color: Rgb565, shadow_opacity: u8, shadow_spread: u8, blur_radius: u8, ) -> Result<(), D::Error>
Render a soft drop shadow around a rounded rectangle.
Sourcepub fn draw_card_fill(
&mut self,
rect: Rect,
radius: u8,
bg_gradient: &AlphaLinearGradient,
shadow_color: Rgb565,
shadow_opacity: u8,
blur_radius: u8,
) -> Result<(), D::Error>
pub fn draw_card_fill( &mut self, rect: Rect, radius: u8, bg_gradient: &AlphaLinearGradient, shadow_color: Rgb565, shadow_opacity: u8, blur_radius: u8, ) -> Result<(), D::Error>
Draw a UI card fill with an alpha gradient background and soft drop shadow.
Sourcepub fn draw_tile(
&mut self,
rect: Rect,
tile: TileRef<'_>,
opacity: u8,
) -> Result<(), D::Error>
pub fn draw_tile( &mut self, rect: Rect, tile: TileRef<'_>, opacity: u8, ) -> Result<(), D::Error>
Render a tile with optional wrapping mode.
Sourcepub fn draw_tile_transformed(
&mut self,
rect: Rect,
tile: TileRef<'_>,
transform: Transform2D,
opacity: u8,
) -> Result<(), D::Error>
pub fn draw_tile_transformed( &mut self, rect: Rect, tile: TileRef<'_>, transform: Transform2D, opacity: u8, ) -> Result<(), D::Error>
Render a transformed tile with optional wrapping mode.
Sourcepub fn draw_tile_transformed_ssaa(
&mut self,
rect: Rect,
tile: TileRef<'_>,
transform: Transform2D,
opacity: u8,
enable_ssaa: bool,
) -> Result<(), D::Error>
pub fn draw_tile_transformed_ssaa( &mut self, rect: Rect, tile: TileRef<'_>, transform: Transform2D, opacity: u8, enable_ssaa: bool, ) -> Result<(), D::Error>
Render a transformed tile with 2xSSAA (2x Super-Sampling Anti-Aliasing).