Struct AvatarFace
pub struct AvatarFace<'a> { /* private fields */ }Expand description
Immediate-mode avatar: the same picture, initials, colour and shape as
Avatar, painted into a rect the caller laid out.
Implementations§
§impl<'a> AvatarFace<'a>
impl<'a> AvatarFace<'a>
pub fn new(name: &'a str, identity: &'a str) -> AvatarFace<'a>
pub fn new(name: &'a str, identity: &'a str) -> AvatarFace<'a>
name gives the initials; identity (a stable id: a peer id, an
address, an account key) picks the presence hue.
pub fn neutral(self) -> AvatarFace<'a>
pub fn neutral(self) -> AvatarFace<'a>
A thing rather than a person (an app without an icon, a device): a neutral square, primary ink on the raised surface.
pub fn status(self, status: PresenceStatus) -> AvatarFace<'a>
pub fn status(self, status: PresenceStatus) -> AvatarFace<'a>
The person’s presence, as a badge on the avatar’s corner in their
colour, ringed in the ground (Self::ringed_on, else the content
surface).
pub fn presence(self, colour: AlphaColor<Srgb>) -> AvatarFace<'a>
pub fn presence(self, colour: AlphaColor<Srgb>) -> AvatarFace<'a>
Use a collaborator’s own presence colour (their chosen identity colour) instead of hashing an id. It is painted at the theme’s presence lightness and chroma, like every other presence mark.
pub fn image(self, image: Option<&'a ImageData>) -> AvatarFace<'a>
pub fn image(self, image: Option<&'a ImageData>) -> AvatarFace<'a>
The person’s picture. Without one the initials show.
pub fn square(self) -> AvatarFace<'a>
pub fn square(self) -> AvatarFace<'a>
A rounded square instead of a circle: an account, a site or an organisation rather than a person.
pub fn ringed_on(self, ground: AlphaColor<Srgb>) -> AvatarFace<'a>
pub fn ringed_on(self, ground: AlphaColor<Srgb>) -> AvatarFace<'a>
Paint a separator ring of ground around the avatar, for avatars that
overlap in a cluster. ground is the surface the cluster sits on.
pub fn initials(&self) -> String
pub fn initials(&self) -> String
The initials this face shows: the first letter of the first two words, upper-cased.
pub fn colour(&self, theme: &Theme) -> AlphaColor<Srgb>
pub fn colour(&self, theme: &Theme) -> AlphaColor<Srgb>
The fallback fill under theme.
pub fn status_rect(&self, rect: Rect, theme: &Theme) -> Rect
pub fn status_rect(&self, rect: Rect, theme: &Theme) -> Rect
Where the presence badge sits for an avatar in rect: on the
bottom-trailing corner, a third of the side.
pub fn paint(&self, ctx: &mut PaintCtx<'_>, rect: Rect)
pub fn paint(&self, ctx: &mut PaintCtx<'_>, rect: Rect)
Paint into rect (the shorter side is the avatar’s side, centred).
pub fn paint_overflow(
ctx: &mut PaintCtx<'_>,
rect: Rect,
count: usize,
ring_on: Option<AlphaColor<Srgb>>,
)
pub fn paint_overflow( ctx: &mut PaintCtx<'_>, rect: Rect, count: usize, ring_on: Option<AlphaColor<Srgb>>, )
The “+N more people” disc that ends an overlapping cluster: the
raised surface with secondary ink. count == 0 paints nothing.
ring_on is the ground of an overlapping cluster, as in
Self::ringed_on.
Trait Implementations§
§impl<'a> Clone for AvatarFace<'a>
impl<'a> Clone for AvatarFace<'a>
§fn clone(&self) -> AvatarFace<'a>
fn clone(&self) -> AvatarFace<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<'a> Debug for AvatarFace<'a>
impl<'a> Debug for AvatarFace<'a>
impl<'a> Copy for AvatarFace<'a>
Auto Trait Implementations§
impl<'a> Freeze for AvatarFace<'a>
impl<'a> !RefUnwindSafe for AvatarFace<'a>
impl<'a> Send for AvatarFace<'a>
impl<'a> Sync for AvatarFace<'a>
impl<'a> Unpin for AvatarFace<'a>
impl<'a> UnsafeUnpin for AvatarFace<'a>
impl<'a> !UnwindSafe for AvatarFace<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more