Yaeh
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package patterns
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
// Border is a pattern that behaves similarly to border-image in CSS. It divides
|
||||
@@ -31,20 +30,20 @@ import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
// This pattern can be used to make a static image texture into something that
|
||||
// responds well to being resized.
|
||||
type Border struct {
|
||||
canvas.Canvas
|
||||
artist.Canvas
|
||||
artist.Inset
|
||||
}
|
||||
|
||||
// Draw draws the border pattern onto the destination canvas within the given
|
||||
// bounds.
|
||||
func (pattern Border) Draw (destination canvas.Canvas, bounds image.Rectangle) {
|
||||
func (pattern Border) Draw (destination artist.Canvas, bounds image.Rectangle) {
|
||||
drawBounds := bounds.Canon().Intersect(destination.Bounds())
|
||||
if drawBounds.Empty() { return }
|
||||
|
||||
srcSections := nonasect(pattern.Bounds(), pattern.Inset)
|
||||
srcTextures := [9]Texture { }
|
||||
for index, section := range srcSections {
|
||||
srcTextures[index].Canvas = canvas.Cut(pattern, section)
|
||||
srcTextures[index].Canvas = artist.Cut(pattern, section)
|
||||
}
|
||||
|
||||
dstSections := nonasect(bounds, pattern.Inset)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package patterns
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
// Texture is a pattern that tiles the content of a canvas both horizontally and
|
||||
// vertically.
|
||||
type Texture struct {
|
||||
canvas.Canvas
|
||||
artist.Canvas
|
||||
}
|
||||
|
||||
// Draw tiles the pattern's canvas within the given bounds. The minimum
|
||||
// point of the pattern's canvas will be lined up with the minimum point of the
|
||||
// bounding rectangle.
|
||||
func (pattern Texture) Draw (destination canvas.Canvas, bounds image.Rectangle) {
|
||||
func (pattern Texture) Draw (destination artist.Canvas, bounds image.Rectangle) {
|
||||
dstBounds := bounds.Canon().Intersect(destination.Bounds())
|
||||
if dstBounds.Empty() { return }
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@ package patterns
|
||||
|
||||
import "image"
|
||||
import "image/color"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist/shapes"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist/artutil"
|
||||
|
||||
// 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 canvas.Canvas, bounds image.Rectangle) {
|
||||
func (pattern Uniform) Draw (destination artist.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(artist.Hex(color))
|
||||
return Uniform(artutil.Hex(color))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user