★ wanayoo — archive 1999 https://github.com/libtcod/python-tcod/issues/87Nouvelle recherche | Portail wanayoo
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

tcod.image_load() is deprecated and yet there's no replacement #87

Open
mgedmin opened this issue Sep 18, 2019 · 3 comments
Open

tcod.image_load() is deprecated and yet there's no replacement #87

mgedmin opened this issue Sep 18, 2019 · 3 comments
Assignees
Labels

Comments

@mgedmin
Copy link

@mgedmin mgedmin commented Sep 18, 2019

Using

import tcod
background = tcod.image_load("background.png")

produces a PendingDeprecationWarning: This function may be deprecated in the future. Consider raising an issue on GitHub if you need this feature.

I was unable to find any replacement for this function. Constructing a new image and setting its data by repeated calls to Image.put_pixel() does not seem reasonable (plus I don't wish to write my own PNG loader).

@HexDecimal HexDecimal self-assigned this Sep 18, 2019
@HexDecimal
Copy link
Collaborator

@HexDecimal HexDecimal commented Sep 18, 2019

Libtcod's image object has some dynamic internal stuff which makes it hard to port properly.

Image.put_pixel is not an alternative to tcod.image_load. put_pixel would be deprecated itself if Image had an accessible pixel buffer array. If you need to use an Image object then ignore the warning in tcod.image_load.

The long-term plan is to have functions return and accept NumPy arrays instead of Image.

@mgedmin
Copy link
Author

@mgedmin mgedmin commented Sep 19, 2019

Ah, I wondered why many objects had numpy arrays but not Image.

My goal was to take the TCOD Tutorial code and make it run without warnings with the latest python-tcod. I now see that that is impossible. :(

@HexDecimal
Copy link
Collaborator

@HexDecimal HexDecimal commented Sep 20, 2019

I've added some new functions in the latest version (11.4.0). With tcod.image.load and Console.draw_semigraphics you should be able to avoid the Image class and the related libtcodpy functions.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.