Skip to content

Multiple tile transformations applied incorrectly #93

@doctorstal

Description

@doctorstal

I allowed every tile transformation in a map

transform.zip

But it comes broken from the renderer:
Image

After I made some changes to RotateTileImage, it looks as expected:
Image

Here are the diff of the changes that I've made (I can create a PR if it's a valid fix):

diff --git a/render/orthogonal.go b/render/orthogonal.go
index 9e2d1d9..cfe762d 100644
--- a/render/orthogonal.go
+++ b/render/orthogonal.go
@@ -47,15 +47,15 @@ func (e *OrthogonalRendererEngine) GetFinalImageSize() image.Rectangle {
 // RotateTileImage rotates provided tile layer.
 func (e *OrthogonalRendererEngine) RotateTileImage(tile *tiled.LayerTile, img image.Image) image.Image {
 	timg := img
+	if tile.DiagonalFlip {
+		timg = imaging.FlipH(imaging.Rotate270(timg))
+	}
 	if tile.HorizontalFlip {
 		timg = imaging.FlipH(timg)
 	}
 	if tile.VerticalFlip {
 		timg = imaging.FlipV(timg)
 	}
-	if tile.DiagonalFlip {
-		timg = imaging.FlipH(imaging.Rotate90(timg))
-	}
 
 	return timg
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions