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: u32Logical width in pixels (the coordinate space the app draws into).
height: u32Logical height in pixels.
rotation: RotationPhysical scan rotation from logical space to the framebuffer.
color_format: ColorFormatNative 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: u32Target 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
impl Screen
Sourcepub const fn new(width: u32, height: u32, rotation: Rotation) -> Self
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.
Sourcepub const fn landscape(width: u32, height: u32) -> Self
pub const fn landscape(width: u32, height: u32) -> Self
Create an unrotated landscape screen (Rotation::Deg0,
32-bit ARGB, 60 Hz).
Sourcepub const fn with_color_format(self, color_format: ColorFormat) -> Self
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.
Sourcepub const fn with_frame_hz(self, frame_hz: u32) -> Self
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.
Sourcepub const fn logical_size(&self) -> (u32, u32)
pub const fn logical_size(&self) -> (u32, u32)
Logical size in the application’s coordinate space.
Sourcepub const fn physical_size(&self) -> (u32, u32)
pub const fn physical_size(&self) -> (u32, u32)
Physical framebuffer dimensions. Axes are swapped when the rotation is 90° or 270°.