Icons are now no longer patterns, they are images
This commit is contained in:
parent
9e8e986977
commit
82e92f1e2e
@ -4,6 +4,12 @@ import "image"
|
|||||||
import "image/draw"
|
import "image/draw"
|
||||||
import "image/color"
|
import "image/color"
|
||||||
|
|
||||||
|
// Image represents an immutable canvas.
|
||||||
|
type Image interface {
|
||||||
|
image.Image
|
||||||
|
RGBAAt (x, y int) color.RGBA
|
||||||
|
}
|
||||||
|
|
||||||
// Canvas is like draw.Image but is also able to return a raw pixel buffer for
|
// Canvas is like draw.Image but is also able to return a raw pixel buffer for
|
||||||
// more efficient drawing. This interface can be easily satisfied using a
|
// more efficient drawing. This interface can be easily satisfied using a
|
||||||
// BasicCanvas struct.
|
// BasicCanvas struct.
|
||||||
|
@ -3,6 +3,7 @@ package theme
|
|||||||
import "image"
|
import "image"
|
||||||
import "golang.org/x/image/font"
|
import "golang.org/x/image/font"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||||
|
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/defaultfont"
|
import "git.tebibyte.media/sashakoshka/tomo/defaultfont"
|
||||||
|
|
||||||
// Default is the default theme.
|
// Default is the default theme.
|
||||||
@ -23,9 +24,9 @@ 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, Case) artist.Pattern {
|
func (Default) Icon (string, Case, IconSize) canvas.Image {
|
||||||
// TODO
|
// TODO
|
||||||
return uhex(0)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pattern returns a pattern from the default theme corresponding to the given
|
// Pattern returns a pattern from the default theme corresponding to the given
|
||||||
|
@ -3,6 +3,15 @@ package theme
|
|||||||
import "image"
|
import "image"
|
||||||
import "golang.org/x/image/font"
|
import "golang.org/x/image/font"
|
||||||
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.
|
||||||
|
type IconSize int
|
||||||
|
|
||||||
|
const (
|
||||||
|
IconSizeSmall IconSize = 16
|
||||||
|
IconSizeLarge IconSize = 48
|
||||||
|
)
|
||||||
|
|
||||||
// Pattern lists a number of cannonical pattern types, each with its own ID.
|
// Pattern lists a number of cannonical pattern types, each with its own ID.
|
||||||
// This allows custom elements to follow themes, even those that do not
|
// This allows custom elements to follow themes, even those that do not
|
||||||
@ -52,8 +61,8 @@ type Theme interface {
|
|||||||
// FontFace returns the proper font for a given style, size, and case.
|
// FontFace returns the proper font for a given style, size, and case.
|
||||||
FontFace (FontStyle, FontSize, Case) font.Face
|
FontFace (FontStyle, FontSize, Case) font.Face
|
||||||
|
|
||||||
// Icon returns an appropriate icon given an icon name and case.
|
// Icon returns an appropriate icon given an icon name, size, and case.
|
||||||
Icon (string, Case) artist.Pattern
|
Icon (string, IconSize, Case) canvas.Image
|
||||||
|
|
||||||
// Pattern returns an appropriate pattern given a pattern name, case,
|
// Pattern returns an appropriate pattern given a pattern name, case,
|
||||||
// and state.
|
// and state.
|
||||||
@ -84,9 +93,9 @@ 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) artist.Pattern {
|
func (wrapped Wrapped) Icon (name string, size IconSize) canvas.Image {
|
||||||
real := wrapped.ensure()
|
real := wrapped.ensure()
|
||||||
return real.Icon(name, wrapped.Case)
|
return real.Icon(name, size, wrapped.Case)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pattern returns an appropriate pattern given a pattern name and state.
|
// Pattern returns an appropriate pattern given a pattern name and state.
|
||||||
|
Reference in New Issue
Block a user