2020-12-28 23:51:27 +00:00
|
|
|
//! 2D graphics/rendering. Fonts, textures, color, geometry, tessellation etc.
|
2020-08-09 15:24:32 +00:00
|
|
|
|
2020-05-19 20:28:57 +00:00
|
|
|
pub mod color;
|
2020-12-29 00:13:14 +00:00
|
|
|
mod shadow;
|
2021-01-10 10:43:01 +00:00
|
|
|
pub mod shape;
|
2020-10-17 08:57:25 +00:00
|
|
|
pub mod stats;
|
2021-01-10 13:39:03 +00:00
|
|
|
mod stroke;
|
2020-07-23 08:27:21 +00:00
|
|
|
pub mod tessellator;
|
2021-01-10 13:39:03 +00:00
|
|
|
pub mod text;
|
2020-05-19 20:28:57 +00:00
|
|
|
mod texture_atlas;
|
2021-01-10 13:39:03 +00:00
|
|
|
mod triangles;
|
2020-05-19 20:28:57 +00:00
|
|
|
|
|
|
|
pub use {
|
2021-01-02 16:02:18 +00:00
|
|
|
color::{Color32, Rgba},
|
2020-12-29 00:13:14 +00:00
|
|
|
shadow::Shadow,
|
2021-01-10 13:39:03 +00:00
|
|
|
shape::Shape,
|
2020-10-17 08:57:25 +00:00
|
|
|
stats::PaintStats,
|
2021-01-10 13:39:03 +00:00
|
|
|
stroke::Stroke,
|
|
|
|
tessellator::{PaintJob, PaintJobs, TessellationOptions},
|
|
|
|
text::{Galley, TextStyle},
|
2020-11-09 20:55:56 +00:00
|
|
|
texture_atlas::{Texture, TextureAtlas},
|
2021-01-10 13:39:03 +00:00
|
|
|
triangles::{Triangles, Vertex},
|
2020-05-19 20:28:57 +00:00
|
|
|
};
|
2020-12-29 00:13:14 +00:00
|
|
|
|
2021-01-10 13:39:03 +00:00
|
|
|
/// The UV coordinate of a white region of the texture mesh.
|
|
|
|
/// The default Egui texture has the top-left corner pixel fully white.
|
|
|
|
/// You need need use a clamping texture sampler for this to work
|
|
|
|
/// (so it doesn't do bilinear blending with bottom right corner).
|
|
|
|
pub const WHITE_UV: crate::Pos2 = crate::pos2(0.0, 0.0);
|
|
|
|
|
|
|
|
/// What texture to use in a [`Triangles`] mesh.
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
|
|
pub enum TextureId {
|
|
|
|
/// The Egui font texture.
|
|
|
|
/// If you don't want to use a texture, pick this and the [`WHITE_UV`] for uv-coord.
|
|
|
|
Egui,
|
|
|
|
|
|
|
|
/// Your own texture, defined in any which way you want.
|
|
|
|
/// Egui won't care. The backend renderer will presumably use this to look up what texture to use.
|
|
|
|
User(u64),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for TextureId {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::Egui
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-29 00:13:14 +00:00
|
|
|
pub(crate) struct PaintRect {
|
|
|
|
pub rect: crate::Rect,
|
|
|
|
/// How rounded the corners are. Use `0.0` for no rounding.
|
|
|
|
pub corner_radius: f32,
|
2021-01-02 16:02:18 +00:00
|
|
|
pub fill: Color32,
|
2020-12-29 00:13:14 +00:00
|
|
|
pub stroke: Stroke,
|
|
|
|
}
|