Skip to main content
← PSoXide SDK guides and examples · SDK 80d1c329e977 · All Cargo features enabled; check feature gates before use.

BrightnessOverlay

Struct BrightnessOverlay 

Source
#[repr(C, align(4))]
pub struct BrightnessOverlay { pub tag: u32, pub draw_mode: u32, pub color_command: u32, pub origin: u32, pub size: u32, }
Expand description

The overlay packet: a draw-mode word and one semi-transparent grey rectangle (GP0 62h) covering the frame, as one linked-list node.

Link it into slot 0 of the frame’s ordering table before anything else is inserted there. An insert prepends and slot 0 is walked last, so the first node in is the last drawn, and the overlay then lifts or dims the HUD and menus along with the scene. The draw area and offset must cover the whole frame when it runs (a split screen widens them first); its rectangle starts at the draw offset’s origin.

It leaves GP0(E1h) set to its own semi-transparent mode with dithering off, as the last node of a frame; the next frame’s first packets set their own draw mode.

use psx_display::Brightness;
use psx_gpu::display::Resolution;
let overlay = Brightness::new(-2).overlay(Resolution::R320X240).unwrap();
assert_eq!(overlay.color_command & 0x00FF_FFFF, 16 * 0x0001_0101);
assert!(Brightness::DEFAULT.overlay(Resolution::R320X240).is_none());

Fields§

§tag: u32

OT linkage.

§draw_mode: u32

GP0(E1h) draw mode selecting B + F (brighter) or B - F (darker).

§color_command: u32

Semi-transparent flat rectangle opcode and the grey, 0x62gggggg.

§origin: u32

Top-left corner, relative to the draw offset.

§size: u32

Width and height.

Implementations§

Source§

impl BrightnessOverlay

Source

pub const WORDS: u8 = 4

Data-word count after the tag.

Source

pub const fn new(brightness: Brightness, resolution: Resolution) -> Self

The overlay for brightness over a resolution frame. At Brightness::DEFAULT the gain is zero and the packet changes nothing, but prefer Brightness::overlay, which gives no packet.

Source

pub const fn words(&self) -> [u32; 4]

The four payload words in the order the GPU reads them, for a caller that copies packets into its own arena instead of linking this one.

Trait Implementations§

Source§

impl Clone for BrightnessOverlay

Source§

fn clone(&self) -> BrightnessOverlay

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BrightnessOverlay

Source§

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

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

impl GpuPacket for BrightnessOverlay

Source§

const WORDS: u8 = BrightnessOverlay::WORDS

Payload words after the tag.
Source§

impl Hash for BrightnessOverlay

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given [Hasher]. Read more
Source§

impl PartialEq for BrightnessOverlay

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BrightnessOverlay

Source§

impl Eq for BrightnessOverlay

Source§

impl StructuralPartialEq for BrightnessOverlay

Auto Trait Implementations§

§

impl Freeze for BrightnessOverlay

§

impl RefUnwindSafe for BrightnessOverlay

§

impl Send for BrightnessOverlay

§

impl Sync for BrightnessOverlay

§

impl Unpin for BrightnessOverlay

§

impl UnsafeUnpin for BrightnessOverlay

§

impl UnwindSafe for BrightnessOverlay

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.