Added extra methods onto Imager.

This is done instead of text substitution, as images might have contexts
and other important attributes. One such example is an emoji, which may
have worked with text substitution, but would also work with a simple
string append.
This commit is contained in:
diamondburned (Forefront) 2020-06-17 20:45:30 -07:00
parent 05b7a6a10c
commit e953dbbcb1
1 changed files with 8 additions and 0 deletions

View File

@ -31,7 +31,15 @@ type Linker interface {
// image. Only the starting bound matters, as images cannot substitute texts.
type Imager interface {
Segment
// Image returns the URL for the image.
Image() (url string)
// ImageSize returns the requested dimension for the image. This function
// could return (0, 0), which the frontend should use the image's
// dimensions.
ImageSize() (w, h int)
// ImageText returns the underlying text of the image. Frontends could use
// this for hovering or displaying the text instead of the image.
ImageText() string
}
// Colorer is a text color format that a segment could implement. This is to be