pub struct CairoRenderContext<'a> { /* private fields */ }
Implementations§
§impl<'a> CairoRenderContext<'a>
impl<'a> CairoRenderContext<'a>
pub fn new(ctx: &Context) -> CairoRenderContext<'_>
pub fn new(ctx: &Context) -> CairoRenderContext<'_>
Create a new Cairo back-end.
At the moment, it uses the “toy text API” for text layout, but when we change to a more sophisticated text layout approach, we’ll probably need a factory for that as an additional argument.
Trait Implementations§
§impl<'a> RenderContext for CairoRenderContext<'a>
impl<'a> RenderContext for CairoRenderContext<'a>
§type TextLayout = CairoTextLayout
type TextLayout = CairoTextLayout
The type use to represent text layout objects.
§type Image = CairoImage
type Image = CairoImage
The associated type of an image.
§fn solid_brush(&mut self, color: Color) -> Brush
fn solid_brush(&mut self, color: Color) -> Brush
Create a new brush resource. Read more
§fn gradient(
&mut self,
gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>
fn gradient( &mut self, gradient: impl Into<FixedGradient> ) -> Result<Brush, Error>
Create a new gradient brush.
§fn fill(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CairoRenderContext<'a>>
)
fn fill( &mut self, shape: impl Shape, brush: &impl IntoBrush<CairoRenderContext<'a>> )
Fill a
Shape
, using the non-zero fill rule.§fn fill_even_odd(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CairoRenderContext<'a>>
)
fn fill_even_odd( &mut self, shape: impl Shape, brush: &impl IntoBrush<CairoRenderContext<'a>> )
Fill a shape, using the even-odd fill rule.
§fn stroke(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CairoRenderContext<'a>>,
width: f64
)
fn stroke( &mut self, shape: impl Shape, brush: &impl IntoBrush<CairoRenderContext<'a>>, width: f64 )
Stroke a
Shape
, using the default StrokeStyle
.§fn stroke_styled(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CairoRenderContext<'a>>,
width: f64,
style: &StrokeStyle
)
fn stroke_styled( &mut self, shape: impl Shape, brush: &impl IntoBrush<CairoRenderContext<'a>>, width: f64, style: &StrokeStyle )
Stroke a
Shape
, providing a custom StrokeStyle
.§fn text(&mut self) -> &mut <CairoRenderContext<'a> as RenderContext>::Text
fn text(&mut self) -> &mut <CairoRenderContext<'a> as RenderContext>::Text
§fn draw_text(
&mut self,
layout: &<CairoRenderContext<'a> as RenderContext>::TextLayout,
pos: impl Into<Point>
)
fn draw_text( &mut self, layout: &<CairoRenderContext<'a> as RenderContext>::TextLayout, pos: impl Into<Point> )
Draw a
TextLayout
. Read more§fn current_transform(&self) -> Affine
fn current_transform(&self) -> Affine
Returns the transformations currently applied to the context.
§fn make_image(
&mut self,
width: usize,
height: usize,
buf: &[u8],
format: ImageFormat
) -> Result<<CairoRenderContext<'a> as RenderContext>::Image, Error>
fn make_image( &mut self, width: usize, height: usize, buf: &[u8], format: ImageFormat ) -> Result<<CairoRenderContext<'a> as RenderContext>::Image, Error>
§fn draw_image(
&mut self,
image: &<CairoRenderContext<'a> as RenderContext>::Image,
dst_rect: impl Into<Rect>,
interp: InterpolationMode
)
fn draw_image( &mut self, image: &<CairoRenderContext<'a> as RenderContext>::Image, dst_rect: impl Into<Rect>, interp: InterpolationMode )
§fn draw_image_area(
&mut self,
image: &<CairoRenderContext<'a> as RenderContext>::Image,
src_rect: impl Into<Rect>,
dst_rect: impl Into<Rect>,
interp: InterpolationMode
)
fn draw_image_area( &mut self, image: &<CairoRenderContext<'a> as RenderContext>::Image, src_rect: impl Into<Rect>, dst_rect: impl Into<Rect>, interp: InterpolationMode )
§fn capture_image_area(
&mut self,
src_rect: impl Into<Rect>
) -> Result<<CairoRenderContext<'a> as RenderContext>::Image, Error>
fn capture_image_area( &mut self, src_rect: impl Into<Rect> ) -> Result<<CairoRenderContext<'a> as RenderContext>::Image, Error>
§fn blurred_rect(
&mut self,
rect: Rect,
blur_radius: f64,
brush: &impl IntoBrush<CairoRenderContext<'a>>
)
fn blurred_rect( &mut self, rect: Rect, blur_radius: f64, brush: &impl IntoBrush<CairoRenderContext<'a>> )
Draw a rectangle with Gaussian blur. Read more
impl<'a> IntoBrush<CairoRenderContext<'a>> for Brush
Auto Trait Implementations§
impl<'a> RefUnwindSafe for CairoRenderContext<'a>
impl<'a> !Send for CairoRenderContext<'a>
impl<'a> !Sync for CairoRenderContext<'a>
impl<'a> Unpin for CairoRenderContext<'a>
impl<'a> UnwindSafe for CairoRenderContext<'a>
Blanket Implementations§
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.