From: Emiliano <emi...@gm...> - 2025-04-14 20:12:56
|
Dear Hararld, allow me to make a few remarks > This is wrong. Making the Tk_CreateImageType only register for the > current thread is a breaking change. > One may argue that there is nothing in the documentation about threads. > Yes, this was created in times where Tk was not jet thread aware. I don't know the history of Tk before 8.4 days but, reading the code, I had the impression that many data that was once global was moved to a thread specific data, being static (or global) inside the current thread. > Nevertheless, I get the impression that we need a successor for > Tk_CreateImageType with the following features: +1 > - only for current thread This is the current behaviour. I would *really* prefer it to be interp specific. More on this below. > - may return an error (already registered) Or not, but it should be user defined. A flag can be used to signal "replace if already exists" or "error out if already exists". In any case, I think the current behaviour should at least be documented. > - maybe should make a copy of the passed data This is the current behaviour; the Tk_ImageType structure saved in the linked list of currently registered types is a copy of the passed in to Tk_CreateImageType. See https://core.tcl-lang.org/tk/file?ci=trunk&name=generic/tkImage.c&ln=158 > - should have a version in the passed data structure for later extension +1 > - contains an unregister call (which may fail). +1. This will make [unload] it at least possible. I think an important point to decide is whether the type register should be thread specific (as it is today) or interp specific. In the last case, the code implementing it will mimic what any well behaved extension does. > And the "low hanging fruit" "image photo formats" is evolving to a mega > project. As the final image goal is to load into tcl without tk, it > feels even more impossible to reach... There is an extension mentioned in the wiki https://wiki.tcl-lang.org/page/megaimage for image manipulation in Tcl without Tk or external libraries, except the ones required for external formats like jpg or png. While the source vanished from the internet, I have a copy of it at home. Let me know if you are interested and I'll gladly hand it out. Regards. -- Emiliano <emi...@gm...> |