pub struct AvatarBuilder {
    pub name: String,
    pub font_data: Vec<u8>,
    pub font_scale: Scale,
    pub font_color: Vec<i64>,
    pub background_color: Vec<i64>,
    pub length: usize,
    pub width: u32,
    pub height: u32,
    pub contrast_ratio: f32,
    /* private fields */
}
Expand description

Avatar builder that stores the metrics of the image.

Fields

name: String

Initials name string

font_data: Vec<u8>

Vectorized font data

font_scale: Scale

Scale of the font

font_color: Vec<i64>

RGB color of the font

background_color: Vec<i64>

RGB color of the background

length: usize

Size of the inner-text

width: u32

Width of the avatar

height: u32

Height of the avatar

contrast_ratio: f32

Contrast ratio for the colors

Implementations

Construct new AvatarBuilder.

Change the font of the avatar text. You need to include .ttf file. Default style is Hiragino_Sans.

Change the font color. You need to specify hex color code.

Change the uniform scale of font. Default to 150.0.

Change the background color of the avatar. You need to specify hex color code.

Change the length of initials characters taken from the name. Default to 2.

Change the width of the avatar. Default to 300.

Change the height of the avatar. Default to 300.

Change the contrast ratio for the randomly generated avatar. Default to 4.5. Increase the ratio for more clear avatar.

Draw the image according to the metrics given.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Sets value as a parameter of self.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.