Documentation ¶
Overview ¶
Package onlineimage contains image widgets that can fetch from image providers, usually online ones. It provides lazy HiDPI scaling by automatically reloading images when the scale factor changes.
Index ¶
Constants ¶
const MaxFPS = 50
MaxFPS is the maximum FPS to play an animation (often a GIF) at. In reality, the actual frame rate heavily depends on the draw clock of GTK, but this duration determines the background ticker.
For more information, see https://wunkolo.github.io/post/2020/02/buttery-smooth-10fps/.
Variables ¶
var CanAnimate = true
CanAnimate is true by default, which allows EnableAnimation to be called on certain images to allow animations to be played back.
Functions ¶
This section is empty.
Types ¶
type AnimationController ¶
type AnimationController baseImage
func (*AnimationController) ConnectMotion ¶
func (c *AnimationController) ConnectMotion(w gtk.Widgetter)
ConnectMotion connects a motion controller to the given widget that will activate the animation when it's hovered over (entered).
func (*AnimationController) OnHover ¶
func (c *AnimationController) OnHover()
OnHover binds the controller to a motion controller attached to the image widget. When the user hovers over the image, the animation plays.
func (*AnimationController) Start ¶
func (c *AnimationController) Start()
Start starts the animation playback in the background. The animation isn't stopped until it is either unmapped or Stop is called.
func (*AnimationController) Stop ¶
func (c *AnimationController) Stop()
Stop stops the animation playback.
type Avatar ¶
Avatar is an online variant of adaptive.Avatar.
func (*Avatar) Disable ¶
func (a *Avatar) Disable()
Disable disables the online capability of the avatar, and sets the avatar to the default avatar.
func (*Avatar) EnableAnimation ¶
func (a *Avatar) EnableAnimation() *AnimationController
EnableAnimation enables animation for the avatar. The controller is returned for the user to determine when to play the animation.
func (*Avatar) SetFromURL ¶
SetFromURL sets the Avatar's URL.
func (*Avatar) SetSizeRequest ¶
SetSizeRequest sets the avatar size.
type Image ¶
type Image struct { *gtk.Image // contains filtered or unexported fields }
Image is an online variant of gtk.Image.
func (*Image) Disable ¶
func (i *Image) Disable()
Disable disables the online capability of the image, turning it into a normal gtk.Image. To re-enable it, call SetURL again.
func (*Image) EnableAnimation ¶
func (i *Image) EnableAnimation() *AnimationController
EnableAnimation enables animation for the avatar. The controller is returned for the user to determine when to play the animation.
func (*Image) SetSizeRequest ¶
SetSizeRequest sets the minimum size of a widget.
type Picture ¶
type Picture struct { *gtk.Picture // contains filtered or unexported fields }
Picture is an online variant of gtk.Picture.
func NewPicture ¶
NewPicture creates a new Picture.
func (*Picture) Disable ¶
func (p *Picture) Disable()
Disable disables the online capability of the picture, turning it into a normal gtk.Picture. To re-enable it, call SetURL again.
func (*Picture) EnableAnimation ¶
func (p *Picture) EnableAnimation() *AnimationController
EnableAnimation enables animation for the avatar. The controller is returned for the user to determine when to play the animation.
func (*Picture) SetSizeRequest ¶
SetSizeRequest sets the minimum size of a widget.