Skip to main content

AnalogHand

Struct AnalogHand 

Source
pub struct AnalogHand {
    pub kind: HandKind,
    pub length: f32,
    pub tail: f32,
    pub width: f32,
    pub color: Color,
}
Expand description

Analog hand laid out as an oriented bounding box rotating around the face center. Geometry is expressed as fractions of face radius so the same hand renders correctly at any clock size.

Fields§

§kind: HandKind

Which angle this hand follows.

§length: f32

Length from pivot to tip, fraction of face radius.

§tail: f32

Length from pivot to tail end, fraction of face radius (typically 0.0..=0.25). 0.0 = no tail past the pivot.

§width: f32

Hand width, fraction of face radius.

§color: Color

Hand color (alpha modulated by AA coverage at edges).

Implementations§

Source§

impl AnalogHand

Source

pub const fn hour(color: Color) -> Self

Construct an hour hand with sensible defaults.

Source

pub const fn minute(color: Color) -> Self

Construct a minute hand with sensible defaults.

Source

pub const fn second(color: Color) -> Self

Construct a second hand with sensible defaults.

Trait Implementations§

Source§

impl ClockLayer for AnalogHand

Source§

fn bbox(&self, state: &ClockState, bounds: Rect) -> Rect

Pixels this layer might write at state, in absolute framebuffer coordinates. Used for cross-layer dirty union math.
Source§

fn dirty( &self, prev: Option<&ClockState>, state: &ClockState, bounds: Rect, ) -> Rect

Self-induced dirty between prev and state. An empty rect means “I have not changed”; the compositor will still call paint if another layer’s dirty rect intersects this layer’s bbox.
Source§

fn paint(&self, renderer: &mut dyn Renderer, state: &ClockState, bounds: Rect)

Paint this layer at state. Layers must paint within their declared bbox — the compositor relies on that for dirty-rect correctness.

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> 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, 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.