From 810728a479b89088c0518ec9d63a5abebcb6cd40 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 23 Jan 2023 23:58:49 -0500 Subject: [PATCH] Beveled and QuadBeveled both use the same algorithm now --- artist/chisel.go | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/artist/chisel.go b/artist/chisel.go index 42f7855..e1d3406 100644 --- a/artist/chisel.go +++ b/artist/chisel.go @@ -10,26 +10,12 @@ type Beveled struct { // AtWhen satisfies the Pattern interface. func (pattern Beveled) AtWhen (x, y, width, height int) (c color.RGBA) { - var highlighted bool - var bottomCorner bool - - if width > height { - bottomCorner = y > height / 2 - } else { - 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) - } + return QuadBeveled { + pattern.Highlight, + pattern.Shadow, + pattern.Shadow, + pattern.Highlight, + }.AtWhen(x, y, width, height) } // QuadBeveled is like Beveled, but with four sides. A pattern can be specified