blob: cc2359b6d25bdf11fc8cfefd1e3aa8d9e6f3d359 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
//! Build and draw geometry.
pub mod fill;
pub mod frame;
pub mod path;
pub mod stroke;
mod cache;
mod style;
mod text;
pub use cache::Cache;
pub use fill::Fill;
pub use frame::Frame;
pub use path::Path;
pub use stroke::{LineCap, LineDash, LineJoin, Stroke};
pub use style::Style;
pub use text::Text;
pub use crate::gradient::{self, Gradient};
use crate::core::Size;
use crate::Cached;
/// A renderer capable of drawing some [`Self::Geometry`].
pub trait Renderer: crate::core::Renderer {
/// The kind of geometry this renderer can draw.
type Geometry: Cached;
/// The kind of [`Frame`] this renderer supports.
type Frame: frame::Backend<Geometry = Self::Geometry>;
/// Creates a new [`Self::Frame`].
fn new_frame(&self, size: Size) -> Self::Frame;
/// Draws the given [`Self::Geometry`].
fn draw_geometry(&mut self, geometry: Self::Geometry);
}
/// The graphics backend of a geometry renderer.
pub trait Backend {
/// The kind of [`Frame`] this backend supports.
type Frame: frame::Backend;
/// Creates a new [`Self::Frame`].
fn new_frame(&self, size: Size) -> Self::Frame;
}
|