Add Tiler interface
This commit is contained in:
parent
89f7bf47ce
commit
c3c6ff61f5
|
@ -47,6 +47,7 @@ type Pen interface {
|
||||||
Stroke (color.Color) // Sets the stroke to a solid color
|
Stroke (color.Color) // Sets the stroke to a solid color
|
||||||
Fill (color.Color) // Sets the fill to a solid color
|
Fill (color.Color) // Sets the fill to a solid color
|
||||||
Texture (Texture) // Overlaps a texture onto the fill color
|
Texture (Texture) // Overlaps a texture onto the fill color
|
||||||
|
Tiler (Tiler) // Changes the way the texture is tiled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Canvas is an image that supports drawing paths.
|
// Canvas is an image that supports drawing paths.
|
||||||
|
|
|
@ -18,3 +18,19 @@ type TextureCloser interface {
|
||||||
Texture
|
Texture
|
||||||
io.Closer
|
io.Closer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TileArea represents a tiled area of a texture.
|
||||||
|
type TileArea struct {
|
||||||
|
// Source specifies an area of the texture to sample.
|
||||||
|
Source image.Rectangle
|
||||||
|
|
||||||
|
// Destination specifies an area of the destination to draw the texture
|
||||||
|
// onto. If Destination is bigger than Source, the empty space will be
|
||||||
|
// filled by tiling the texture (clipped to source) normally.
|
||||||
|
Destination image.Rectangle
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tiler is a type that changes the way a texture is drawn.
|
||||||
|
type Tiler interface {
|
||||||
|
Tile (image.Rectangle, Texture) []TileArea
|
||||||
|
}
|
||||||
|
|
|
@ -136,6 +136,8 @@ type Box interface {
|
||||||
// transparent, it will be overlayed atop the color specified by
|
// transparent, it will be overlayed atop the color specified by
|
||||||
// SetColor().
|
// SetColor().
|
||||||
SetTexture (canvas.Texture)
|
SetTexture (canvas.Texture)
|
||||||
|
// SetTiler changes the way the texture is tiled.
|
||||||
|
SetTiler (canvas.Tiler)
|
||||||
// SetBorder sets the Border(s) of the box. The first Border will be the
|
// SetBorder sets the Border(s) of the box. The first Border will be the
|
||||||
// most outset, and the last Border will be the most inset.
|
// most outset, and the last Border will be the most inset.
|
||||||
SetBorder (...Border)
|
SetBorder (...Border)
|
||||||
|
|
Loading…
Reference in New Issue