2023-06-29 07:55:52 +02:00
|
|
|
//! Draw using different graphical primitives.
|
2023-11-14 12:49:49 +01:00
|
|
|
pub mod pipeline;
|
|
|
|
|
|
|
|
|
|
pub use pipeline::Pipeline;
|
|
|
|
|
|
2023-06-29 07:48:03 +02:00
|
|
|
use crate::core::Rectangle;
|
|
|
|
|
use crate::graphics::{Damage, Mesh};
|
2023-11-14 12:49:49 +01:00
|
|
|
|
2023-09-14 13:58:36 -07:00
|
|
|
use std::fmt::Debug;
|
2023-06-29 07:48:03 +02:00
|
|
|
|
2023-06-29 07:55:52 +02:00
|
|
|
/// The graphical primitives supported by `iced_wgpu`.
|
2023-06-22 00:38:36 +02:00
|
|
|
pub type Primitive = crate::graphics::Primitive<Custom>;
|
|
|
|
|
|
2023-06-29 07:55:52 +02:00
|
|
|
/// The custom primitives supported by `iced_wgpu`.
|
2023-06-29 07:48:03 +02:00
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
|
|
|
pub enum Custom {
|
2023-06-29 07:55:52 +02:00
|
|
|
/// A mesh primitive.
|
2023-06-29 07:48:03 +02:00
|
|
|
Mesh(Mesh),
|
2023-11-14 12:49:49 +01:00
|
|
|
/// A custom pipeline primitive.
|
|
|
|
|
Pipeline(Pipeline),
|
2023-06-29 07:48:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Damage for Custom {
|
|
|
|
|
fn bounds(&self) -> Rectangle {
|
|
|
|
|
match self {
|
|
|
|
|
Self::Mesh(mesh) => mesh.bounds(),
|
2023-11-14 12:49:49 +01:00
|
|
|
Self::Pipeline(pipeline) => pipeline.bounds,
|
2023-06-29 07:48:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|