crate::slot_handle! {
pub struct OverlayGeometryId;
}
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub struct RetainedOverlay {
pub id: OverlayGeometryId,
pub translate: [f32; 2],
pub opacity: f32,
pub z_order: i32,
pub clip_rect: [f32; 4],
pub clip_id: Option<u32>,
pub tint: [f32; 4],
pub scale: f32,
}
impl RetainedOverlay {
pub fn new(id: OverlayGeometryId) -> Self {
Self {
id,
translate: [0.0, 0.0],
opacity: 1.0,
z_order: 0,
clip_rect: [0.0; 4],
clip_id: None,
tint: [1.0, 1.0, 1.0, 1.0],
scale: 1.0,
}
}
pub fn with_translate(mut self, translate: [f32; 2]) -> Self {
self.translate = translate;
self
}
pub fn with_opacity(mut self, opacity: f32) -> Self {
self.opacity = opacity;
self
}
pub fn with_z_order(mut self, z_order: i32) -> Self {
self.z_order = z_order;
self
}
pub fn with_clip_rect(mut self, clip_rect: [f32; 4]) -> Self {
self.clip_rect = clip_rect;
self
}
pub fn with_clip_mask(mut self, clip_id: u32) -> Self {
self.clip_id = Some(clip_id);
self
}
pub fn with_tint(mut self, tint: [f32; 4]) -> Self {
self.tint = tint;
self
}
pub fn with_scale(mut self, scale: f32) -> Self {
self.scale = scale;
self
}
}