This gzipped tarfile of Tcl scripts (which is also available in an older version) lets you select a file from anywhere on your filesystem. Documentation for both the new version and the old version is also available online. This code has really been rendered obsolete by the tk_getOpenFile command that became available from Tk8.0 onwards.
This C code is something I cobbled together to allow the fairly efficient creation of transparent photo images. It is completely superceded from Tk8.0.0 onwards, where a more efficient mechanism is built into the core.
Load the photo image as normal. Don't bother with the TRANSPARENT_GIF_COLOR variable, as it just confuses...
Create another photo image the same size.
Use my code to copy from the source (step 1) to the destination (step 2) setting all pixels of the colour specified to transparent.
Alternatively, use the procedure photo-transparent included, which does all this for you, returning the new image name created. photo-transparent is just like the image create photo command except in that it accepts the following extra options:
Use the specified image as a source (as opposed to a block of data, file or channel). This overrides the creation of a temporary image, and the image specified by this option is not deleted after use.
A name to use for temporary images. If unsupplied a default value is chosen which is extremely unlikely to be used in any user programs. This image is deleted before exit from the procedure.
The colour to make transparent. Defaults to the contents of the global variable TRANSPARENT_GIF_COLOR if that is defined, or to "#414243" if nothing else is available.
Note that when loading GIFs with transparency, it is the colour that is marked as transparent in the GIF that is made transparent in addition to this colour, so this colour should be chosen so as to make sure that it is not present anywhere except where transparency is desired.
Now that we have the plugin, we'll often be stuffing images into it, but sometimes it is nice to take someone's plugin and convert it back to an ordinary app. This little bit of code is designed to allow that. It can build either a standalone C tool (when the symbol TCLCMD is not defined) or a object file suitable for `load'ing into Tcl8 (when TCLCMD is defined).
I don't currently provide good error messages when it is running as a Tcl command, not that much in the way of error messages is necessary, as the standard is quite flexible...
1st September 2000 - You should now strongly consider using the code in tcllib instead, as that is better supported.
Back to the main index.