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.
art/patterns/uniform.go

21 lines
547 B
Go

package patterns
import "art"
import "image"
import "art/shapes"
import "art/artutil"
import "image/color"
// Uniform is a pattern that draws a solid color.
type Uniform color.RGBA
// Draw fills the bounding rectangle with the pattern's color.
func (pattern Uniform) Draw (destination art.Canvas, bounds image.Rectangle) {
shapes.FillColorRectangle(destination, color.RGBA(pattern), bounds)
}
// Uhex creates a new Uniform pattern from an RGBA integer value.
func Uhex (color uint32) (uniform Uniform) {
return Uniform(artutil.Hex(color))
}