Introduce custom backend-specific primitives

This commit is contained in:
Héctor Ramón Jiménez 2023-06-22 00:38:36 +02:00
parent 8d65e40a11
commit 0ae1baa37b
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
28 changed files with 618 additions and 263 deletions

View file

@ -14,20 +14,10 @@ pub use text::Text;
pub use crate::gradient::{self, Gradient};
use crate::Primitive;
/// A bunch of shapes that can be drawn.
#[derive(Debug, Clone)]
pub struct Geometry(pub Primitive);
impl From<Geometry> for Primitive {
fn from(geometry: Geometry) -> Self {
geometry.0
}
}
/// A renderer capable of drawing some [`Geometry`].
pub trait Renderer: crate::core::Renderer {
type Geometry;
/// Draws the given layers of [`Geometry`].
fn draw(&mut self, layers: Vec<Geometry>);
fn draw(&mut self, layers: Vec<Self::Geometry>);
}