Added Avatarer into package text

This commit adds Avatarer into the list of supported text segments. This
should work very similarly to Imager, except that avatars should be
rounded by the frontend.

This commit should make the text image APIs consistent with the main
cchat package.
This commit is contained in:
diamondburned (Forefront) 2020-07-04 01:15:50 -07:00
parent c8d6c89a08
commit 0abbf861bc
1 changed files with 15 additions and 0 deletions

View File

@ -48,6 +48,21 @@ type Imager interface {
ImageText() string
}
// Avatarer implies the segment should be replaced with a rounded-corners
// image. This works similarly to Imager.
type Avatarer interface {
Segment
// Avatar returns the URL for the image.
Avatar() (url string)
// AvatarSize returns the requested dimension for the image. This function
// could return (0, 0), which the frontend should use the avatar's
// dimensions.
AvatarSize() (size int)
// AvatarText returns the underlying text of the image. Frontends could use
// this for hovering or displaying the text instead of the image.
AvatarText() string
}
// Colorer is a text color format that a segment could implement. This is to be
// applied directly onto the text.
type Colorer interface {