bevy_color::prelude

Trait ColorToComponents

Source
pub trait ColorToComponents {
    // Required methods
    fn to_f32_array(self) -> [f32; 4];
    fn to_f32_array_no_alpha(self) -> [f32; 3];
    fn to_vec4(self) -> Vec4;
    fn to_vec3(self) -> Vec3;
    fn from_f32_array(color: [f32; 4]) -> Self;
    fn from_f32_array_no_alpha(color: [f32; 3]) -> Self;
    fn from_vec4(color: Vec4) -> Self;
    fn from_vec3(color: Vec3) -> Self;
}
Expand description

Trait with methods for converting colors to non-color types

Required Methods§

Source

fn to_f32_array(self) -> [f32; 4]

Convert to an f32 array

Source

fn to_f32_array_no_alpha(self) -> [f32; 3]

Convert to an f32 array without the alpha value

Source

fn to_vec4(self) -> Vec4

Convert to a Vec4

Source

fn to_vec3(self) -> Vec3

Convert to a Vec3

Source

fn from_f32_array(color: [f32; 4]) -> Self

Convert from an f32 array

Source

fn from_f32_array_no_alpha(color: [f32; 3]) -> Self

Convert from an f32 array without the alpha value

Source

fn from_vec4(color: Vec4) -> Self

Convert from a Vec4

Source

fn from_vec3(color: Vec3) -> Self

Convert from a Vec3

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§