This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/artist/patterns/uniform.go

21 lines
658 B
Go
Raw Normal View History

2023-02-25 23:41:16 +00:00
package patterns
2023-01-09 06:03:19 +00:00
import "image"
import "image/color"
2023-02-25 23:41:16 +00:00
import "git.tebibyte.media/sashakoshka/tomo/canvas"
2023-02-26 19:27:38 +00:00
import "git.tebibyte.media/sashakoshka/tomo/artist"
2023-02-25 23:41:16 +00:00
import "git.tebibyte.media/sashakoshka/tomo/artist/shapes"
2023-01-09 06:03:19 +00:00
2023-02-25 23:41:16 +00:00
// Uniform is a pattern that draws a solid color.
2023-01-14 17:41:51 +00:00
type Uniform color.RGBA
2023-01-09 06:03:19 +00:00
// Draw fills the bounding rectangle with the pattern's color.
func (pattern Uniform) Draw (destination canvas.Canvas, bounds image.Rectangle) {
shapes.FillColorRectangle(destination, color.RGBA(pattern), bounds)
2023-01-09 06:03:19 +00:00
}
// Uhex creates a new Uniform pattern from an RGBA integer value.
func Uhex (color uint32) (uniform Uniform) {
2023-02-26 19:27:38 +00:00
return Uniform(artist.Hex(color))
}