Chiseled is now called Beveled

This commit is contained in:
Sasha Koshka 2023-01-20 23:00:26 -05:00
parent a273178a8e
commit 4c1bf070fe
6 changed files with 25 additions and 15 deletions

View File

@ -2,14 +2,14 @@ package artist
import "image/color"
// Chiseled is a pattern that has a highlight section and a shadow section.
type Chiseled struct {
// Beveled is a pattern that has a highlight section and a shadow section.
type Beveled struct {
Highlight Pattern
Shadow Pattern
}
// AtWhen satisfies the Pattern interface.
func (chiseled Chiseled) AtWhen (x, y, width, height int) (c color.RGBA) {
func (pattern Beveled) AtWhen (x, y, width, height int) (c color.RGBA) {
var highlighted bool
var bottomCorner bool
@ -26,8 +26,8 @@ func (chiseled Chiseled) AtWhen (x, y, width, height int) (c color.RGBA) {
}
if highlighted {
return chiseled.Highlight.AtWhen(x, y, width, height)
return pattern.Highlight.AtWhen(x, y, width, height)
} else {
return chiseled.Shadow.AtWhen(x, y, width, height)
return pattern.Shadow.AtWhen(x, y, width, height)
}
}

View File

@ -42,7 +42,7 @@ func (element *AnalogClock) draw () {
bounds := element.core.Bounds()
artist.FillRectangle (
element.core,
element,
theme.SunkenPattern(),
bounds)

View File

@ -20,7 +20,7 @@ type Artist struct {
func NewArtist () (element *Artist) {
element = &Artist { }
element.Core, element.core = core.NewCore(element)
element.core.SetMinimumSize(400, 400)
element.core.SetMinimumSize(400, 480)
return
}
@ -28,14 +28,14 @@ func (element *Artist) Resize (width, height int) {
element.core.AllocateCanvas(width, height)
bounds := element.Bounds()
element.cellBounds.Max.X = bounds.Dx() / 4
element.cellBounds.Max.Y = (bounds.Dy() - 48) / 4
element.cellBounds.Max.Y = (bounds.Dy() - 48) / 5
drawStart := time.Now()
// 0, 0
artist.FillRectangle (
element,
artist.Chiseled {
artist.Beveled {
Highlight: artist.NewUniform(hex(0xFF0000FF)),
Shadow: artist.NewUniform(hex(0x0000FFFF)),
},
@ -107,6 +107,16 @@ func (element *Artist) Resize (width, height int) {
x, element.cellAt(x, 3))
}
// 0, 4
artist.FillEllipse (
element,
artist.Beveled {
Highlight: artist.NewUniform(hex(0xFF0000FF)),
Shadow: artist.NewUniform(hex(0x0000FFFF)),
},
element.cellAt(0, 4))
// how long did that take to render?
drawTime := time.Since(drawStart)
textDrawer := artist.TextDrawer { }
textDrawer.SetFace(defaultfont.FaceRegular)

View File

@ -6,7 +6,7 @@ var buttonPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
},
@ -16,7 +16,7 @@ var selectedButtonPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
},
@ -27,7 +27,7 @@ var pressedButtonPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0x4B5B59FF)),
Shadow: artist.NewUniform(hex(0x8D9894FF)),
},
@ -37,7 +37,7 @@ var pressedSelectedButtonPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0x4B5B59FF)),
Shadow: artist.NewUniform(hex(0x8D9894FF)),
},

View File

@ -6,7 +6,7 @@ var inputPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0x89925AFF)),
Shadow: artist.NewUniform(hex(0xD2CB9AFF)),
},

View File

@ -27,7 +27,7 @@ var sunkenPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Chiseled {
Pattern: artist.Beveled {
Highlight: artist.NewUniform(hex(0x3b534eFF)),
Shadow: artist.NewUniform(hex(0x97a09cFF)),
},