Icons now use textures
This commit is contained in:
parent
b62b846745
commit
5f5b928528
|
@ -1,6 +1,6 @@
|
|||
package theme
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/data"
|
||||
|
||||
// IconSize represents the size of an icon.
|
||||
|
@ -226,16 +226,15 @@ type Icon int; const (
|
|||
IconVolume3
|
||||
)
|
||||
|
||||
// Icon returns an image of the corresponding icon ID.
|
||||
func (id Icon) Image (size IconSize) image.Image {
|
||||
if current == nil { return image.Rect(0, 0, 16, 16) }
|
||||
// Icon returns a texture of the corresponding icon ID.
|
||||
func (id Icon) Image (size IconSize) tomo.Texture {
|
||||
if current == nil { return nil }
|
||||
return current.Icon(id, size)
|
||||
}
|
||||
|
||||
// MimeIcon returns an icon corresponding to a MIME type. This must
|
||||
// always return a non-nil value.
|
||||
func MimeIcon (mime data.Mime, size IconSize) image.Image {
|
||||
if current == nil { return image.Rect(0, 0, 16, 16) }
|
||||
// MimeIcon returns an icon corresponding to a MIME type.
|
||||
func MimeIcon (mime data.Mime, size IconSize) tomo.Texture {
|
||||
if current == nil { return nil }
|
||||
return current.MimeIcon(mime, size)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package theme
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/data"
|
||||
import "git.tebibyte.media/tomo/tomo/event"
|
||||
|
@ -55,17 +54,20 @@ type Theme interface {
|
|||
// RGBA returns the RGBA values of the corresponding color ID.
|
||||
RGBA (Color) (r, g, b, a uint32)
|
||||
|
||||
// Icon returns an image of the corresponding icon ID. This must always
|
||||
// return a non-nil value.
|
||||
Icon (Icon, IconSize) image.Image
|
||||
// Icon returns a texture of the corresponding icon ID. This texture
|
||||
// should be protected, unless a new copy of it is returned with each
|
||||
// subsequent call.
|
||||
Icon (Icon, IconSize) tomo.Texture
|
||||
|
||||
// MimeIcon returns an icon corresponding to a MIME type. This must
|
||||
// always return a non-nil value.
|
||||
MimeIcon (data.Mime, IconSize) image.Image
|
||||
// MimeIcon returns an icon corresponding to a MIME type. This texture
|
||||
// should be protected, unless a new copy of it is returned with each
|
||||
// subsequent call.
|
||||
MimeIcon (data.Mime, IconSize) tomo.Texture
|
||||
|
||||
// ApplicationIcon returns an icon corresponding to an application. This
|
||||
// must always return a non-nil value.
|
||||
ApplicationIcon (ApplicationIcon, IconSize) image.Image
|
||||
// texture should be protected, unless a new copy of it is returned with
|
||||
// each subsequent call.
|
||||
ApplicationIcon (ApplicationIcon, IconSize) tomo.Texture
|
||||
}
|
||||
|
||||
var current Theme
|
||||
|
|
Loading…
Reference in New Issue