Skip to content
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

docs: Provide snippet to get a tile's image #3969

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Jun 14, 2024

Since Tile.image can refer to a larger image, to get only the part representing the tile one needs to make a copy.

See #3960

Since Tile.image can refer to a larger image, to get only the part
representing the tile one needs to make a copy.

See mapeditor#3960
@bjorn bjorn added the documentation Issue related to the Tiled Manual. label Jun 14, 2024
@eishiya
Copy link
Contributor

eishiya commented Jun 16, 2024

If Image.copy had an overload that took a QRect, the snippet could be rather legible one-liner: let image = tile.image.copy(tile.imageRect) hinthintnudgenudge ;D QImage has such a method, perhaps it could be exposed to the API?

Usually, creating a rect using Qt.rect() is needlessly verbose, but it
is very convenient if you already have a rect, like the one obtained
from Tile.imageRect.
@bjorn bjorn merged commit fd9e05e into mapeditor:master Jun 17, 2024
14 of 15 checks passed
@bjorn bjorn deleted the js-doc-add-snippet branch June 17, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue related to the Tiled Manual.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants