Handy.Avatar
Description: Reference for Handy.Avatar

### Class

# HandyAvatar

#### Description [src]

    final class Handy.Avatar : Gtk.DrawingArea {
      /* No available fields */
    }

A widget displaying an image, with a generated fallback.

`HdyAvatar` is a widget to display a round avatar.

A provided image is made round before displaying, if no image is given this widget generates a round fallback with the initials of the `HdyAvatar:text` on top of a colored background.

The color is picked based on the hash of the `HdyAvatar:text`.

If `HdyAvatar:show-initials` is set to `FALSE`, `avatar-default-symbolic` is shown instead of the initials.

Use `hdy_avatar_set_loadable_icon()` or `HdyAvatar:loadable-icon` to set a custom image.

## CSS nodes

`HdyAvatar` has a single CSS node with name `avatar`.

Available since: | 1.0

#### Ancestors

- GtkDrawingArea
- GtkWidget
- GInitiallyUnowned
- GObject

#### Implements

- AtkImplementorIface
- GtkBuildable

#### Constructors

###### hdy_avatar_new

Creates a new `HdyAvatar`.

Available since: 1.0

#### Instance methods

###### hdy_avatar_draw_to_pixbuf

Renders `self` into a `GdkPixbuf` at `size` and `scale_factor`.

Available since: 1.2

###### hdy_avatar_draw_to_pixbuf_async

Renders asynchronously `self` into a pixbuf at `size` and `scale_factor`.

Available since: 1.2

###### hdy_avatar_draw_to_pixbuf_finish

Finishes an asynchronous draw of an avatar to a pixbuf.

Available since: 1.2

###### hdy_avatar_get_icon_name

Gets the name of an icon to use as a fallback.

Available since: 1.0

###### hdy_avatar_get_loadable_icon

Gets the `GLoadableIcon` set via `hdy_avatar_set_loadable_icon()`.

Available since: 1.2

###### hdy_avatar_get_show_initials

Gets whether initials are used instead of an icon on the fallback avatar.

Available since: 1.0

###### hdy_avatar_get_size

Gets the size of the avatar.

Available since: 1.0

###### hdy_avatar_get_text

Gets the text used to generate the fallback initials and color.

Available since: 1.0

###### hdy_avatar_set_icon_name

Sets the name of an icon to use as a fallback.

Available since: 1.0

###### hdy_avatar_set_image_load_func

A callback which is called when the custom image needs to be reloaded.

Available since: 1.0

Deprecated since: 1.2

###### hdy_avatar_set_loadable_icon

Sets the `GLoadableIcon` to use as an avatar.

Available since: 1.2

###### hdy_avatar_set_show_initials

Sets whether to use initials instead of an icon on the fallback avatar.

Available since: 1.0

###### hdy_avatar_set_size

Sets the size of the avatar.

Available since: 1.0

###### hdy_avatar_set_text

Set the text used to generate the fallback initials color.

Available since: 1.0

#### Properties

###### Handy.Avatar:icon-name

The name of an icon to use as a fallback.

Available since: 1.0

###### Handy.Avatar:loadable-icon

A `GLoadableIcon` used to load the avatar.

Available since: 1.2

###### Handy.Avatar:show-initials

Whether to show the initials or the fallback icon on the generated avatar.

Available since: 1.0

###### Handy.Avatar:size

The avatar size of the avatar.

Available since: 1.0

###### Handy.Avatar:text

Sets the text used to generate the fallback initials and color.

Available since: 1.0

#### Class structure

    struct HandyAvatarClass {
      GtkDrawingAreaClass parent_class;

    }

###### Class members

`parent_class` |
    GtkDrawingAreaClass
| No description available.