Created Icon interface
This commit is contained in:
parent
ecaad02c0b
commit
ae6cf128f8
14
artist/icon.go
Normal file
14
artist/icon.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package artist
|
||||||
|
|
||||||
|
import "image"
|
||||||
|
import "image/color"
|
||||||
|
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||||
|
|
||||||
|
type Icon interface {
|
||||||
|
// Draw draws the icon to the destination canvas at the specified point,
|
||||||
|
// using the specified color (if the icon is monochrome).
|
||||||
|
Draw (destination canvas.Canvas, color color.RGBA, at image.Point)
|
||||||
|
|
||||||
|
// Bounds returns the bounds of the icon.
|
||||||
|
Bounds () image.Rectangle
|
||||||
|
}
|
BIN
theme/assets/wintergreen-icons-small.png
Normal file
BIN
theme/assets/wintergreen-icons-small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -84,14 +84,14 @@ func (Default) FontFace (style FontStyle, size FontSize, c Case) font.Face {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Icon returns an icon from the default set corresponding to the given name.
|
// Icon returns an icon from the default set corresponding to the given name.
|
||||||
func (Default) Icon (string, IconSize, Case) canvas.Image {
|
func (Default) Icon (string, IconSize, Case) artist.Icon {
|
||||||
// TODO
|
// TODO
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MimeIcon returns an icon from the default set corresponding to the given mime.
|
// MimeIcon returns an icon from the default set corresponding to the given mime.
|
||||||
// type.
|
// type.
|
||||||
func (Default) MimeIcon (data.Mime, IconSize, Case) canvas.Image {
|
func (Default) MimeIcon (data.Mime, IconSize, Case) artist.Icon {
|
||||||
// TODO
|
// TODO
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import "image/color"
|
|||||||
import "golang.org/x/image/font"
|
import "golang.org/x/image/font"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
|
||||||
|
|
||||||
// IconSize is a type representing valid icon sizes.
|
// IconSize is a type representing valid icon sizes.
|
||||||
type IconSize int
|
type IconSize int
|
||||||
@ -148,6 +147,7 @@ type Icon int; const (
|
|||||||
IconRemoveBookmark
|
IconRemoveBookmark
|
||||||
IconAddFavorite
|
IconAddFavorite
|
||||||
IconRemoveFavorite
|
IconRemoveFavorite
|
||||||
|
|
||||||
IconPlay
|
IconPlay
|
||||||
IconPause
|
IconPause
|
||||||
IconStop
|
IconStop
|
||||||
@ -197,11 +197,11 @@ type Theme interface {
|
|||||||
FontFace (FontStyle, FontSize, Case) font.Face
|
FontFace (FontStyle, FontSize, Case) font.Face
|
||||||
|
|
||||||
// Icon returns an appropriate icon given an icon name, size, and case.
|
// Icon returns an appropriate icon given an icon name, size, and case.
|
||||||
Icon (string, IconSize, Case) canvas.Image
|
Icon (string, IconSize, Case) artist.Icon
|
||||||
|
|
||||||
// Icon returns an appropriate icon given a file mime type, size, and,
|
// Icon returns an appropriate icon given a file mime type, size, and,
|
||||||
// case.
|
// case.
|
||||||
MimeIcon (data.Mime, IconSize, Case) canvas.Image
|
MimeIcon (data.Mime, IconSize, Case) artist.Icon
|
||||||
|
|
||||||
// Pattern returns an appropriate pattern given a pattern name, case,
|
// Pattern returns an appropriate pattern given a pattern name, case,
|
||||||
// and state.
|
// and state.
|
||||||
|
@ -5,7 +5,6 @@ import "image/color"
|
|||||||
import "golang.org/x/image/font"
|
import "golang.org/x/image/font"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
|
||||||
|
|
||||||
// Wrapped wraps any theme and injects a case into it automatically so that it
|
// Wrapped wraps any theme and injects a case into it automatically so that it
|
||||||
// doesn't need to be specified for each query. Additionally, if the underlying
|
// doesn't need to be specified for each query. Additionally, if the underlying
|
||||||
@ -22,13 +21,13 @@ func (wrapped Wrapped) FontFace (style FontStyle, size FontSize) font.Face {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Icon returns an appropriate icon given an icon name.
|
// Icon returns an appropriate icon given an icon name.
|
||||||
func (wrapped Wrapped) Icon (name string, size IconSize) canvas.Image {
|
func (wrapped Wrapped) Icon (name string, size IconSize) artist.Icon {
|
||||||
real := wrapped.ensure()
|
real := wrapped.ensure()
|
||||||
return real.Icon(name, size, wrapped.Case)
|
return real.Icon(name, size, wrapped.Case)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MimeIcon returns an appropriate icon given file mime type.
|
// MimeIcon returns an appropriate icon given file mime type.
|
||||||
func (wrapped Wrapped) MimeIcon (mime data.Mime, size IconSize) canvas.Image {
|
func (wrapped Wrapped) MimeIcon (mime data.Mime, size IconSize) artist.Icon {
|
||||||
real := wrapped.ensure()
|
real := wrapped.ensure()
|
||||||
return real.MimeIcon(mime, size, wrapped.Case)
|
return real.MimeIcon(mime, size, wrapped.Case)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user