Fix centered texture rendering
This commit is contained in:
parent
36ac66b644
commit
9214f70b61
12
box.go
12
box.go
@ -339,10 +339,14 @@ func (this *box) Draw (can canvas.Canvas) {
|
|||||||
// centered texture
|
// centered texture
|
||||||
if this.textureMode == textureModeCenter {
|
if this.textureMode == textureModeCenter {
|
||||||
textureBounds := this.texture.Bounds()
|
textureBounds := this.texture.Bounds()
|
||||||
textureOrigin := image.Pt (
|
textureOrigin :=
|
||||||
textureBounds.Dx() / -2,
|
bounds.Min.
|
||||||
textureBounds.Dy() / -2).
|
Add(image.Pt (
|
||||||
Add(bounds.Min)
|
bounds.Dx() / 2,
|
||||||
|
bounds.Dy() / 2)).
|
||||||
|
Sub(image.Pt (
|
||||||
|
textureBounds.Dx() / 2,
|
||||||
|
textureBounds.Dy() / 2))
|
||||||
|
|
||||||
pen.Fill(color.Transparent)
|
pen.Fill(color.Transparent)
|
||||||
pen.Texture(this.texture)
|
pen.Texture(this.texture)
|
||||||
|
Reference in New Issue
Block a user