Beveled and QuadBeveled both use the same algorithm now
This commit is contained in:
parent
468d4e9dab
commit
810728a479
@ -10,26 +10,12 @@ type Beveled struct {
|
|||||||
|
|
||||||
// AtWhen satisfies the Pattern interface.
|
// AtWhen satisfies the Pattern interface.
|
||||||
func (pattern Beveled) AtWhen (x, y, width, height int) (c color.RGBA) {
|
func (pattern Beveled) AtWhen (x, y, width, height int) (c color.RGBA) {
|
||||||
var highlighted bool
|
return QuadBeveled {
|
||||||
var bottomCorner bool
|
pattern.Highlight,
|
||||||
|
pattern.Shadow,
|
||||||
if width > height {
|
pattern.Shadow,
|
||||||
bottomCorner = y > height / 2
|
pattern.Highlight,
|
||||||
} else {
|
}.AtWhen(x, y, width, height)
|
||||||
bottomCorner = x < width / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
if bottomCorner {
|
|
||||||
highlighted = float64(x) < float64(height) - float64(y)
|
|
||||||
} else {
|
|
||||||
highlighted = float64(width) - float64(x) > float64(y)
|
|
||||||
}
|
|
||||||
|
|
||||||
if highlighted {
|
|
||||||
return pattern.Highlight.AtWhen(x, y, width, height)
|
|
||||||
} else {
|
|
||||||
return pattern.Shadow.AtWhen(x, y, width, height)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// QuadBeveled is like Beveled, but with four sides. A pattern can be specified
|
// QuadBeveled is like Beveled, but with four sides. A pattern can be specified
|
||||||
|
Reference in New Issue
Block a user