Trait bevy::prelude::ClampColor

pub trait ClampColor: Sized {
    // Required methods
    fn clamped(&self) -> Self;
    fn is_within_bounds(&self) -> bool;

    // Provided method
    fn clamp(&mut self) { ... }
}
Expand description

Trait with methods for asserting a colorspace is within bounds.

During ordinary usage (e.g. reading images from disk, rendering images, picking colors for UI), colors should always be within their ordinary bounds (such as 0 to 1 for RGB colors). However, some applications, such as high dynamic range rendering or bloom rely on unbounded colors to naturally represent a wider array of choices.

Required Methods§

fn clamped(&self) -> Self

Return a new version of this color clamped, with all fields in bounds.

fn is_within_bounds(&self) -> bool

Are all the fields of this color in bounds?

Provided Methods§

fn clamp(&mut self)

Changes all the fields of this color to ensure they are within bounds.

Object Safety§

This trait is not object safe.

Implementors§