data-oriented-patterns #9

Merged
sashakoshka merged 21 commits from data-oriented-patterns into main 2023-03-01 11:07:08 -07:00
3 changed files with 4 additions and 3 deletions
Showing only changes of commit 449922851f - Show all commits

View File

@ -52,7 +52,8 @@ func DrawShatter (
) ( ) (
updatedRegion image.Rectangle, updatedRegion image.Rectangle,
) { ) {
return Draw(destination, source, shatter.Shatter(destination.Bounds(), rocks...)...) tiles := shatter.Shatter(destination.Bounds(), rocks...)
return Draw(destination, source, tiles...)
} }
// AllocateSample returns a new canvas containing the result of a pattern. The // AllocateSample returns a new canvas containing the result of a pattern. The

View File

@ -461,5 +461,5 @@ func (element *List) draw () {
).Add(innerBounds.Min).Intersect(innerBounds) ).Add(innerBounds.Min).Intersect(innerBounds)
pattern := element.theme.Pattern(theme.PatternSunken, state) pattern := element.theme.Pattern(theme.PatternSunken, state)
artist.DrawShatter ( artist.DrawShatter (
element.core, pattern, bounds, covered) element.core, pattern, covered)
} }

View File

@ -76,7 +76,7 @@ func (entry *ListEntry) Draw (
return entry.drawer.Draw ( return entry.drawer.Draw (
destination, destination,
foreground, foreground,
offset.Add(image.Pt(padding[3], padding[0])). offset.Add(image.Pt(padding[artist.SideLeft], padding[artist.SideTop])).
Sub(entry.drawer.LayoutBounds().Min)) Sub(entry.drawer.LayoutBounds().Min))
} }