pub struct ColorCorrection {
pub red: f32,
pub green: f32,
pub blue: f32,
}
Expand description
Defines color correction factors for LED hardware.
ColorCorrection
contains scaling factors for each RGB component to
compensate for differences in LED brightness and color balance.
This allows for more accurate color reproduction on specific LED hardware.
§When to Use
Use ColorCorrection
when:
- Working with LED strips or arrays with unbalanced color output
- You need a white point correction for your specific LEDs
- Calibrating a display system for accurate color reproduction
- Compensating for RGB LED intensity differences
Fields§
§red: f32
Scaling factor for red channel
green: f32
Scaling factor for green channel
blue: f32
Scaling factor for blue channel
Implementations§
Source§impl ColorCorrection
impl ColorCorrection
Sourcepub fn new(red: f32, green: f32, blue: f32) -> ColorCorrection
pub fn new(red: f32, green: f32, blue: f32) -> ColorCorrection
Creates a new color correction with the specified scaling factors.
§Arguments
red
- Scaling factor for the red channelgreen
- Scaling factor for the green channelblue
- Scaling factor for the blue channel
§Returns
A new ColorCorrection
instance.
§Example
use blinksy::color::ColorCorrection;
// Create a correction for LEDs with strong red, weak blue
let correction = ColorCorrection::new(0.8, 1.0, 1.4);
Sourcepub fn from_temperature(temperature: u32) -> ColorCorrection
pub fn from_temperature(temperature: u32) -> ColorCorrection
Creates a color correction from color temperature adjustment.
This creates a color correction that simulates adjusting the white point to a specific color temperature.
§Arguments
temperature
- Approximate color temperature in Kelvin (e.g., 2700K, 6500K)
§Returns
A ColorCorrection
instance that approximates the desired color temperature.
§Example
use blinksy::color::ColorCorrection;
// Create a warm white (incandescent-like) correction
let warm = ColorCorrection::from_temperature(2700);
// Create a cool white (daylight-like) correction
let cool = ColorCorrection::from_temperature(6500);
Trait Implementations§
Source§impl Clone for ColorCorrection
impl Clone for ColorCorrection
Source§fn clone(&self) -> ColorCorrection
fn clone(&self) -> ColorCorrection
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ColorCorrection
impl Debug for ColorCorrection
Source§impl Default for ColorCorrection
impl Default for ColorCorrection
Source§fn default() -> ColorCorrection
fn default() -> ColorCorrection
Returns the “default value” for a type. Read more
Source§impl PartialEq for ColorCorrection
impl PartialEq for ColorCorrection
impl Copy for ColorCorrection
impl StructuralPartialEq for ColorCorrection
Auto Trait Implementations§
impl Freeze for ColorCorrection
impl RefUnwindSafe for ColorCorrection
impl Send for ColorCorrection
impl Sync for ColorCorrection
impl Unpin for ColorCorrection
impl UnwindSafe for ColorCorrection
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromColor<T> for T
impl<T> FromColor<T> for T
Source§fn from_color(color: T) -> T
fn from_color(color: T) -> T
Converts from the source color type
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Converts into the target color type
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.