Skip to main content

ScreenImageVisual

Struct ScreenImageVisual 

Source
pub struct ScreenImageVisual { /* private fields */ }
Expand description

An immutable image drawn in logical screen pixels above world content.

Position is the top-left corner, x increases rightward, and y increases downward. Finite offscreen placement is allowed. Geometry, tint, layer, and draw-order depth use the same validation as ScreenRectangleVisual. The component needs no Transform, window, or GPU, and FrameUpdate may change it. Extraction samples current values and excludes disabled entities.

Construction validates image-region dimensions from the issued handle; extraction also checks that its application registry owns the image. A foreign handle is not made valid by constructing this component. Within screen content, layer, depth, and stable entity identity control ordering; a rectangle precedes an image on an exact same-entity tie. No input capture or hit testing is implied by visibility.

Implementations§

Source§

impl ScreenImageVisual

Source

pub const fn rotation(&self) -> f32

Returns clockwise radians about the destination rectangle’s center. The top-left position and size describe the unrotated rectangle.

Source

pub fn set_rotation(&mut self, radians: f32) -> Result<(), ImageVisualError>

Sets clockwise center rotation, reducing finite angles to 0..TAU. No image pixels are recreated. Failure leaves the visual unchanged.

Source

pub fn contains_pointer(&self, sample: PointerSample) -> bool

Tests the rotated destination and fixed clip, not individual texel alpha. The caller still selects eligibility and resolves overlapping targets.

Source

pub const fn clip(&self) -> ScreenClip

Returns the fixed-screen clip; content placement does not move it.

Source

pub fn set_clip(&mut self, clip: ScreenClip)

Replaces the screen clip, independent of source texels and destination.

Source

pub fn new( image: ImageAssetId, position: LogicalScreenPosition, size: LogicalScreenVector, ) -> Result<Self, ImageVisualError>

Places the full image with white tint and nearest-texel sampling.

The default layer and depth zero match screen rectangles. Position must be finite; size must be positive and finite, with finite, increasing far bounds. Geometry is independent from the image’s texel dimensions.

Source

pub const fn image(&self) -> ImageAssetId

Returns the immutable application image handle used by this visual.

Source

pub const fn source_region(&self) -> Option<ImageRegion>

Returns the source texel rectangle, or None for the complete image.

Source

pub const fn filter(&self) -> ImageFilter

Returns the sampling policy used when scaling this image.

Source

pub const fn position(&self) -> LogicalScreenPosition

Returns the top-left destination in logical screen pixels.

Source

pub const fn size(&self) -> LogicalScreenVector

Returns the positive destination width and height in logical pixels.

Source

pub const fn tint(&self) -> Color

Returns the normalized straight-linear RGBA multiplication tint.

Source

pub const fn layer(&self) -> Layer

Returns the primary ordering layer within screen content.

Source

pub const fn draw_order_depth(&self) -> f32

Returns the finite within-layer draw order, unrelated to camera depth.

Source

pub fn set_image(&mut self, image: ImageAssetId) -> Result<(), ImageVisualError>

Replaces the image while retaining its source region and presentation.

If the existing region does not fit the new image, nothing changes. With no explicit region, the new image’s complete extent is selected. Application provenance is checked later by extraction.

Source

pub fn set_source_region( &mut self, region: Option<ImageRegion>, ) -> Result<(), ImageVisualError>

Selects exact source texels, or resets to the full image with None.

A region outside the selected image leaves every component field unchanged. This changes sampling, not destination position or size.

Source

pub fn set_filter(&mut self, filter: ImageFilter)

Replaces the sampling policy without changing image or geometry.

Source

pub fn set_geometry( &mut self, position: LogicalScreenPosition, size: LogicalScreenVector, ) -> Result<(), ImageVisualError>

Replaces position and size together using screen rectangle validation.

Invalid values leave the component unchanged. Finite negative and offscreen positions are accepted without clamping or source cropping.

Source

pub fn set_position( &mut self, position: LogicalScreenPosition, ) -> Result<(), ImageVisualError>

Replaces position while retaining size; invalid bounds change nothing.

Source

pub fn set_size( &mut self, size: LogicalScreenVector, ) -> Result<(), ImageVisualError>

Replaces size while retaining position; invalid bounds change nothing.

Source

pub fn set_tint(&mut self, tint: Color) -> Result<(), ImageVisualError>

Replaces normalized straight-linear RGBA tint atomically.

A non-finite channel or value outside 0.0..=1.0 changes nothing.

Source

pub fn set_layer(&mut self, layer: Layer)

Replaces the primary ordering layer within screen content.

Source

pub fn set_draw_order_depth( &mut self, depth: f32, ) -> Result<(), ImageVisualError>

Replaces finite within-layer ordering depth; invalid input changes nothing.

Negative depths are valid and do not change camera projection.

Trait Implementations§

Source§

impl Clone for ScreenImageVisual

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for ScreenImageVisual
where Self: Send + Sync + 'static,

Source§

const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table

A constant indicating the storage type used for this component.
Source§

type Mutability = Mutable

A marker type to assist Bevy with determining if this component is mutable, or immutable. Mutable components will have Component<Mutability = Mutable>, while immutable components will instead have Component<Mutability = Immutable>. Read more
Source§

fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )

Registers required components. Read more
Source§

fn clone_behavior() -> ComponentCloneBehavior

Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
Source§

fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>

Returns ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read more
Source§

fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_add ComponentHook for this Component if one is defined.
Source§

fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_insert ComponentHook for this Component if one is defined.
Source§

fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_discard ComponentHook for this Component if one is defined.
Source§

fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_remove ComponentHook for this Component if one is defined.
Source§

fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_despawn ComponentHook for this Component if one is defined.
Source§

fn map_entities<E>(_this: &mut Self, _mapper: &mut E)
where E: EntityMapper,

Maps the entities on this component using the given 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 more
Source§

impl Copy for ScreenImageVisual

Source§

impl Debug for ScreenImageVisual

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ScreenImageVisual

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScreenImageVisual

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C> Bundle for C
where C: Component,

Source§

fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>

Source§

fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>

Return a iterator over this Bundle’s component ids. This will be None if the component has not been registered.
Source§

impl<C> BundleFromComponents for C
where C: Component,

Source§

unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
where F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a>, C: Sized,

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<C> DynamicBundle for C
where C: Component,

Source§

type Effect = ()

An operation on the entity that happens after inserting this bundle.
Source§

unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect

Moves the components out of the bundle. Read more
Source§

unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )

Applies the after-effects of spawning this bundle. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WorldEvent for T
where T: Copy + Send + Sync + 'static,