pub struct Visuals {
pub fill: Option<Fill>,
pub radius: f32,
pub corner_radii: Option<[f32; 4]>,
pub shadows: Vec<ShadowSpec>,
pub border: Option<Border>,
}Expand description
Visual record for one rect: optional fill (solid or gradient), uniform corner radius, and stacked shadows.
fill = Noneemits no rect; the entity behaves as a layout-only container.- Opacity is held in
Opacityseparately so it composes with text, image, and SVG paint too.
Fields§
§fill: Option<Fill>Background fill. None emits no rect.
radius: f32Uniform corner radius in logical pixels (0 = sharp).
corner_radii: Option<[f32; 4]>Per-corner radii [top-left, top-right, bottom-right, bottom-left] (CSS border-radius 2-4 value shorthand /
per-corner longhands). When Some, the paint path uses these
and Self::radius carries the max corner for uniform-only
consumers (knob geometry, focus rings).
shadows: Vec<ShadowSpec>Stacked shadows in source order. Each comma-separated CSS box-shadow entry produces one ShadowSpec; inset entries set inner = true and render clipped to the rect.
border: Option<Border>CSS border paint: per-side widths + one color, solid style.
None = no border (style none). Painted inside the border box
(between the outer edge and the padding box), above the
background fill and below children - exactly CSS’s
background -> border -> content order. The matching layout-space
widths live in Style::border.
Implementations§
Source§impl Visuals
impl Visuals
Sourcepub fn primary_shadow(&self) -> Option<&ShadowSpec>
pub fn primary_shadow(&self) -> Option<&ShadowSpec>
Returns a reference to the first ShadowSpec in shadows, or None when the vector is empty.
Trait Implementations§
Source§impl Component for Visuals
impl Component for Visuals
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreimpl StructuralPartialEq for Visuals
Auto Trait Implementations§
impl Freeze for Visuals
impl RefUnwindSafe for Visuals
impl Send for Visuals
impl Sync for Visuals
impl Unpin for Visuals
impl UnsafeUnpin for Visuals
impl UnwindSafe for Visuals
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.