Skip to main content

Crate hashavatar

Crate hashavatar 

Source
Expand description

Procedural, asset-free avatar generation driven by stable identity hashes.

The crate produces deterministic avatar images from an input identifier without shipping image packs, sprites, or third-party artwork. All visual output is drawn from code using geometric primitives.

Typical usage:

use hashavatar::{
    AvatarBackground, AvatarKind, AvatarOptions, AvatarOutputFormat, AvatarSpec,
    encode_avatar_for_id,
};

let bytes = encode_avatar_for_id(
    AvatarSpec::new(256, 256, 0),
    "alice@example.com",
    AvatarOutputFormat::WebP,
    AvatarOptions {
        kind: AvatarKind::Robot,
        background: AvatarBackground::White,
    },
)?;

Structs§

AvatarIdentity
A stable avatar identity derived from a SHA-512 digest.
AvatarNamespace
AvatarOptions
AvatarSpec
Input parameters for a generated avatar image.
CatAvatar
Cat-face avatar renderer built from simple geometric primitives.
Color
RGBA color helper for concise shape drawing.
HashedCatAvatar
Cat-face avatar renderer driven by a SHA-512 identity.
HashedDogAvatar
HashedRobotAvatar

Enums§

AvatarBackground
AvatarKind
AvatarOutputFormat
Export formats for encoded avatar assets.

Constants§

AVATAR_STYLE_VERSION
Rendering contract version for deterministic avatars.

Traits§

AvatarRenderer
Trait for renderers that can draw reusable avatar styles onto an image buffer.

Functions§

encode_avatar
Render and encode an avatar into memory.
encode_avatar_for_id
encode_avatar_for_namespace
encode_cat_avatar
Render and encode a cat avatar into memory.
encode_cat_avatar_for_id
Render and encode a cat avatar for a stable identity string.
export_avatar
Render and write an avatar to disk.
export_avatar_svg_for_id
export_avatar_svg_for_namespace
export_cat_avatar
Render and write a cat avatar to disk.
export_cat_avatar_for_id
Render and write a cat avatar for a stable identity string.
render_alien_avatar_for_identity
render_avatar_for_id
Render an avatar image directly without encoding it.
render_avatar_for_namespace
render_avatar_svg_for_id
Render an avatar as a compact SVG string.
render_avatar_svg_for_namespace
render_bird_avatar_for_identity
render_cat_avatar
Render a cat face avatar into an RGBA image.
render_cat_avatar_for_identity
Render a cat face avatar from a SHA-512-backed identity.
render_cat_avatar_for_identity_with_background
render_dog_avatar_for_identity
render_fox_avatar_for_identity
render_ghost_avatar_for_identity
render_monster_avatar_for_identity
render_paws_avatar_for_identity
render_robot_avatar_for_identity
render_skull_avatar_for_identity
render_slime_avatar_for_identity
render_wizard_avatar_for_identity