Skip to main content

ClockFace

Struct ClockFace 

Source
pub struct ClockFace {
    pub hour_color: Color,
    pub minute_color: Option<Color>,
    pub hour_size: TickSize,
    pub minute_size: TickSize,
}
Expand description

Helper that constructs a standard set of TickMark layers (12 hour marks and optionally 48 minute marks at non-hour positions) and pushes them onto a Clock in z-order. Call this before pushing hand layers so the hands paint on top of the face.

Sizes are deliberately conservative defaults; for custom faces construct individual TickMarks and push them with Clock::push_layer.

Fields§

§hour_color: Color

Color for hour marks (12 marks at cardinal positions).

§minute_color: Option<Color>

Color for minute marks; None disables them.

§hour_size: TickSize

Outer radius / length / width of hour marks (fractions of radius).

§minute_size: TickSize

Outer radius / length / width of minute marks.

Implementations§

Source§

impl ClockFace

Source

pub const fn standard(hour_color: Color, minute_color: Color) -> Self

Standard 12-hour-mark + 48-minute-mark face.

Source

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

12 hour marks, no minute marks.

Source

pub fn push_layers(&self, clock: &mut Clock)

Push tick layers onto clock in z-order: minute marks first (so hour marks paint on top at cardinal positions if their bboxes overlap).

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.