Skip to content

Multiple tile transformations applied incorrectly #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
doctorstal opened this issue Mar 21, 2025 · 1 comment
Open

Multiple tile transformations applied incorrectly #93

doctorstal opened this issue Mar 21, 2025 · 1 comment
Labels

Comments

@doctorstal
Copy link

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
 }
@lafriks
Copy link
Owner

lafriks commented Mar 25, 2025

Looks like a valid fix, please submit PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants