Created FillRectangleShatter for convenience

This commit is contained in:
Sasha Koshka
2023-02-16 18:18:44 -05:00
parent fc0a9292d9
commit f8240fb518
4 changed files with 24 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ package artist
import "image"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/shatter"
// Paste transfers one canvas onto another, offset by the specified point.
func Paste (
@@ -75,6 +76,23 @@ func FillRectangleClip (
return
}
// FillRectangleShatter shatters a bounding rectangle and draws its tiles in one
// fell swoop.
func FillRectangleShatter (
destination canvas.Canvas,
source Pattern,
glass image.Rectangle,
rocks ...image.Rectangle,
) (
updatedRegions []image.Rectangle,
) {
tiles := shatter.Shatter(glass, rocks...)
for _, tile := range tiles {
FillRectangleClip(destination, source, glass, tile)
}
return tiles
}
// StrokeRectangle draws the outline of a rectangle with the specified line
// weight and pattern.
func StrokeRectangle (