Skip to main content

Screen

Struct Screen 

Source
pub struct Screen {
    pub width: u32,
    pub height: u32,
    pub rotation: Rotation,
    pub color_format: ColorFormat,
    pub frame_hz: u32,
}
Expand description

Logical display geometry plus the scan rotation used to reach the physical framebuffer.

Fields§

§width: u32

Logical width in pixels (the coordinate space the app draws into).

§height: u32

Logical height in pixels.

§rotation: Rotation

Physical scan rotation from logical space to the framebuffer.

§color_format: ColorFormat

Native colour format of the physical display panel.

Application rendering always happens in 32-bit ARGB internally; this field tells the simulator how to quantize its preview to match the target panel so artefacts like RGB565 banding are visible on the host. Hardware drivers ignore the field — their own flush already targets the panel’s native format.

§frame_hz: u32

Target display refresh rate in Hz.

Declared by the target project and consumed by every timing loop that wants to match the hardware cadence: the simulator’s frame sleep, the gesture recognisers’ tap / double-tap timeouts, and motion engines like rlvgl_widgets::motion::crawl::StarCrawl that need pixels_per_sec / frame_hz to turn into the right Q8 scroll-advance value.

Hardware drivers may still read this to program SysTick; the field is purely advisory for drivers whose own cadence comes from a real display controller.

Implementations§

Source§

impl Screen

Source

pub const fn new(width: u32, height: u32, rotation: Rotation) -> Self

Create a screen with an explicit rotation. Defaults to true-colour ColorFormat::Argb8888 and DEFAULT_FRAME_HZ (60 Hz); use Self::with_color_format and Self::with_frame_hz to opt into a lower-depth simulation or a different refresh rate.

Source

pub const fn landscape(width: u32, height: u32) -> Self

Create an unrotated landscape screen (Rotation::Deg0, 32-bit ARGB, 60 Hz).

Source

pub const fn with_color_format(self, color_format: ColorFormat) -> Self

Return a copy of this screen with a different colour format.

Use this to declare that the target panel is, for example, RGB565 — the simulator will then quantize its preview window through the same colour format so banding artefacts become visible.

Source

pub const fn with_frame_hz(self, frame_hz: u32) -> Self

Return a copy of this screen with a different target refresh rate. frame_hz = 0 is clamped to 1 to keep divide-by-zero guards further down the stack trivial.

Source

pub const fn logical_size(&self) -> (u32, u32)

Logical size in the application’s coordinate space.

Source

pub const fn physical_size(&self) -> (u32, u32)

Physical framebuffer dimensions. Axes are swapped when the rotation is 90° or 270°.

Trait Implementations§

Source§

impl Clone for Screen

Source§

fn clone(&self) -> Screen

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Screen

Source§

impl Debug for Screen

Source§

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

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

impl Eq for Screen

Source§

impl PartialEq for Screen

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Screen

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.