euv-core 0.48.3

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Rare paint effect payload stored out-of-line in `EffectTable` so standard nodes stay cache-compact.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct PaintEffectEntry {
    /// Optional drop shadow specification.
    #[get(skip)]
    pub(crate) shadow: Option<Shadow>,
    /// Optional two-stop linear gradient background fill.
    #[get(skip)]
    pub(crate) gradient: Option<LinearGradient>,
    /// 2D visual transform applied during painting without triggering layout.
    #[get(type(copy))]
    pub(crate) transform: Transform2D,
    /// Optional outer focus ring stroke.
    #[get(skip)]
    pub(crate) focus_ring: Option<Border>,
    /// Backdrop blur radius in logical pixels (`0.0` when disabled).
    #[get(type(copy))]
    pub(crate) backdrop_blur: f32,
}

/// Sparse slot-recycled table storing rare `PaintEffectEntry` payloads indexed by 1-based `effect_id` (`0` = none).
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct EffectTable {
    /// Contiguous slot storage (`index = effect_id - 1`).
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(skip)]
    pub(crate) entries: Vec<Option<PaintEffectEntry>>,
    /// Recycled 0-based slot indices for O(1) effect insertion.
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(skip)]
    pub(crate) free_slots: Vec<u32>,
    /// Incrementally maintained count of active effect entries.
    #[get(pub(crate), type(copy))]
    #[get_mut(skip)]
    #[set(pub(crate))]
    pub(crate) live_count: usize,
}

/// Dense 32-byte cache-compact paint style storing hot fields inline and referencing rare effects via `effect_id`.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct CompactPaintStyle {
    /// Solid background color (valid when `COMPACT_PAINT_HAS_BACKGROUND` is set in `flags`).
    #[get(type(copy))]
    pub(crate) background: Color,
    /// Border stroke color.
    #[get(type(copy))]
    pub(crate) border_color: Color,
    /// Border stroke width in logical pixels.
    #[get(type(copy))]
    pub(crate) border_width: f32,
    /// Quarter-pixel quantized corner radii `[top_left, top_right, bottom_right, bottom_left]`.
    #[get(pub(crate), type(copy))]
    #[get_mut(skip)]
    #[set(pub(crate))]
    pub(crate) radii_q4: [u16; 4],
    /// Node opacity in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) opacity: f32,
    /// 1-based index into `EffectTable` (`EFFECT_ID_NONE == 0` when no rare effects are present).
    #[get(type(copy))]
    pub(crate) effect_id: u32,
    /// Packed bitflags encoding background presence, scroll/event propagation guards, cursor icon, and pointer policy.
    #[get(type(copy))]
    pub(crate) flags: u32,
}