OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000684OMNeT++runtime / Tkenvpublic2013-11-12 12:312013-12-11 15:36
andras 
andras 
normalmajoralways
resolvedfixed 
Mac OS X10.9
4.3 
4.4 
0000684: Module icons are missing in Tkenv
When running a simulation under Tkenv, module icons are missing (do not appear). All other icons (toolbar buttons, tree nodes, etc) are OK. No error in .tkenvlog.

This bug appeared in version 10.9 of OS X, previous versions were OK.

Using the stock Tcl/TkAqua framework.
No tags attached.
Issue History
2013-11-12 12:31andrasNew Issue
2013-11-12 12:31andrasStatusnew => confirmed
2013-11-12 12:36andrasNote Added: 0000820
2013-11-12 12:38andrasNote Edited: 0000820
2013-11-12 12:46andrasNote Added: 0000821
2013-11-12 13:18andrasNote Added: 0000822
2013-11-15 16:10andrasNote Added: 0000823
2013-11-19 08:02merturkNote Added: 0000829
2013-11-19 11:57andrasNote Added: 0000830
2013-11-26 12:43alexmajyNote Added: 0000837
2013-11-26 19:44andrasNote Added: 0000838
2013-11-27 00:39alexmajyNote Added: 0000839
2013-11-27 12:46andrasNote Added: 0000840
2013-12-11 15:34rhornigAssigned To => andras
2013-12-11 15:36rhornigNote Added: 0000862
2013-12-11 15:36rhornigStatusconfirmed => resolved
2013-12-11 15:36rhornigFixed in Version => 4.4
2013-12-11 15:36rhornigResolutionopen => fixed

Notes
(0000820)
andras   
2013-11-12 12:36   
(edited on: 2013-11-12 12:38)
Results of a brief investigation:

GIF files (e.g. old/*) seem to be displayed correctly.

In the Aloha sample, background/terrain.png appears OK, but module icons are missing. The difference between terrain.png and other PNGs (e.g. block/*) is depth: terrain.png is 8-bit, others are 32-bit. Converting block/queue.png to 8-bit PNG confirms that indeed 8-bit PNGs are displayed correctly.

Thus a possible workaround: convert all PNGs to 8-bit.

(0000821)
andras   
2013-11-12 12:46   
Since the same OMNeT++ version works on previous versions of OS X, problem is likely outside OMNeT++, e.g. in the shipped Tcl/Tk Aqua framework or (unlikely) OS X.

Upgrading TkPNG inside Tkenv to the latest version (1.6 to 1.18, see http://tkpng.cvs.sourceforge.net/viewvc/tkpng/tkpng/generic/ [^]) did not help.

Regarding the fact that only 8-bit images work, the strange thing is that Tk internally converts all images to 32-bit (see e.g. the colorize and resize functions in tkenv/tkcmd.cc -- they work on 4 bytes per pixel buffers).

Apparently the loading of 32-bit images results in a bogus data structure, different from the result of converting 8-bit images to 32 bits internally.
(0000822)
andras   
2013-11-12 13:18   
Tk_PhotoGetImage + Tk_PhotoPutBlock doesn't fix a bogus image.
(0000823)
andras   
2013-11-15 16:10   
Real cause: images with partial transparency are not displayed. I.e. if image contains 1 pixel where alpha is neither 0 not 255, it is not displayed!

Workaround: convert all alpha values to 0 or 255 on OS X.
(0000829)
merturk   
2013-11-19 08:02   
You can update tcl and tcllib with macports, It works for me http://dev.omnetpp.org/bugs/view.php?id=683 [^]
(0000830)
andras   
2013-11-19 11:57   
But the macports version is X11 not the Aqua version, right? So it doesn't look as nice :)

Meanwhile I implemented quantizing the alpha channel to 1 bit in all images in the Tkenv code when the TkAqua lib is in use.
(0000837)
alexmajy   
2013-11-26 12:43   
With homebrew tcl-tck(aqua tk 8.6.0) and xcode 5.0, omnetpp 4.3 can be successfully compiled on Mac OS X Mavericks. And there is no image display problem. However, the C indexer problem of ide seems to remaim.
(0000838)
andras   
2013-11-26 19:44   
Thank you, we'll try it. Maybe it also solves other issues we have with Tkenv on OS X.
(0000839)
alexmajy   
2013-11-27 00:39   
Sorry, I forgot to mention that, to compile omnetpp 4.3, I have edited two files as follow:

omnetpp-4.3/src/nedxml/nederror.h add #include <string>
omnetpp-4.3/include/simutil.h #include <string.h> ----> #include <string>
(0000840)
andras   
2013-11-27 12:46   
For OMNeT++ 4.4, we'll continue to use the bundled Apple Tcl/Tk version. I tried Tk 8.6.1 from MacPorts. It's TkAqua not X11, but it's no better than the Apple one with the Tkenv fixes I already implemented since 4.3.1. Still no partial transparency (it forces alpha to be 0 or 255 on images), Tkenv still comes up in the background, '-relief sunken' still not implemented for buttons, etc. In only fixes one minor issue, the flickering of the OK button on the initial 'choose config' dialog.
(0000862)
rhornig   
2013-12-11 15:36   
8 bit alpha channel is converted to 1 bit transparency aon Mac OS X as Tkenv in 10.9 does not display those images.