pub struct Brightness(/* private fields */);Expand description
The BRIGHTNESS setting: Brightness::MIN to Brightness::MAX, where
Brightness::DEFAULT (zero) is the picture as drawn.
use psx_display::Brightness;
let mut brightness = Brightness::DEFAULT;
brightness = brightness.stepped(1);
assert_eq!(brightness.label().as_str(), "BRIGHTER 1");
brightness = brightness.stepped(-3);
assert_eq!(brightness.label().as_str(), "DARKER 2");Implementations§
Source§impl Brightness
impl Brightness
Sourcepub const STEP_COUNT: i8 = 5
pub const STEP_COUNT: i8 = 5
Steps either side of the picture as drawn.
Sourcepub const fn level(self) -> i8
pub const fn level(self) -> i8
The signed step: negative darker, positive brighter, zero as drawn.
Sourcepub const fn is_default(self) -> bool
pub const fn is_default(self) -> bool
Whether this is the picture as drawn, which needs no overlay.
Sourcepub const fn stepped(self, delta: i8) -> Self
pub const fn stepped(self, delta: i8) -> Self
This setting moved by delta steps (left is negative, right
positive), stopping at the ends instead of wrapping.
Sourcepub const fn label_for_level(level: i8) -> Label
pub const fn label_for_level(level: i8) -> Label
The row text for any signed level, with no clamp. A game whose own
brightness steps are not five either side (a palette with its own
count of gamma rows) keeps its range and its application and shows
the same words through this.
Sourcepub const fn to_byte(self) -> u8
pub const fn to_byte(self) -> u8
The save byte: the step in two’s complement, so zero (the default) is also what a save from before the setting reads as.
Sourcepub const fn from_byte(byte: u8) -> Self
pub const fn from_byte(byte: u8) -> Self
The setting a save byte holds. Any byte decodes: one outside the range is clamped to the nearest end.
Sourcepub const fn overlay_gain(self) -> u8
pub const fn overlay_gain(self) -> u8
Grey of 255 the overlay carries: zero at the default, else the step count times 8, darker or brighter. On the GPU’s five bits that is exactly the step count (1 to 5) subtracted or added per channel.
Sourcepub const fn faded_gain(self, fade: u8) -> u8
pub const fn faded_gain(self, fade: u8) -> u8
The overlay grey while a screen fades: overlay_gain
scaled by fade, where 128 is the screen at full strength. A fade to
black then still ends black instead of a lifted grey.
Sourcepub const fn overlay(self, resolution: Resolution) -> Option<BrightnessOverlay>
pub const fn overlay(self, resolution: Resolution) -> Option<BrightnessOverlay>
The overlay for a resolution frame, or None at the default (no
packet, no GPU work, no per-frame cost).
Sourcepub const fn faded_overlay(
self,
resolution: Resolution,
fade: u8,
) -> Option<BrightnessOverlay>
pub const fn faded_overlay( self, resolution: Resolution, fade: u8, ) -> Option<BrightnessOverlay>
The overlay for a screen mid-fade (see faded_gain),
or None when the setting is at the default or the fade has taken the
grey to nothing.
Trait Implementations§
Source§impl Clone for Brightness
impl Clone for Brightness
Source§fn clone(&self) -> Brightness
fn clone(&self) -> Brightness
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Brightness
impl Debug for Brightness
Source§impl Default for Brightness
impl Default for Brightness
Source§fn default() -> Brightness
fn default() -> Brightness
Source§impl Hash for Brightness
impl Hash for Brightness
Source§impl PartialEq for Brightness
impl PartialEq for Brightness
impl Copy for Brightness
impl Eq for Brightness
impl StructuralPartialEq for Brightness
Auto Trait Implementations§
impl Freeze for Brightness
impl RefUnwindSafe for Brightness
impl Send for Brightness
impl Sync for Brightness
impl Unpin for Brightness
impl UnsafeUnpin for Brightness
impl UnwindSafe for Brightness
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)