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