This is not necessarily the current version of this TIP.
| TIP: | 14 |
| Title: | Access to Tk Photo Image Transparency |
| Version: | $Revision: 2.3 $ |
| Author: | Donal K. Fellows <fellowsd at cs dot man dot ac dot uk> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.4.0 |
| Vote: | In progress |
| Created: | Wednesday, 22 November 2000 |
| Keywords: | Tk, photo, transparency, internal, access |
It is useful for some code (both extensions and scripts) to have access to the transparency information in photo images for various reasons, but this is not currently available, even via an internal structure defined in generic/tkInt.h. This TIP is aimed at making the information available, and in such a way at the C level that backward compatibility is maintained in the future even if the internal structure definitions change.
I have been working for several years (on-and-off) on an extension for Tk that allows it to have non-rectangular windows (http://www.cs.man.ac.uk/~fellowsd/tcl/shapeidx.html) which is an effect that is great for all sorts of purposes but which comes particularly into its own when used in conjunction with drag-and-drop to make drag tokens that obscure only part of what lies underneath them. However, one of the most useful ways of specifying the shape of a window turns out to be via images of various kinds, and the natural way to do this is with the transparency data within the image. The problem is that this data is locked up entirely within structures that are completely private to generic/tkImgPhoto.c; none of it is visible at all anywhere else, even within the core. (There is code that uses colour data instead to do this sort of trick, http://www.sys.uea.ac.uk/~fuzz/tktrans/default.html, but this is a slow process and frankly a little strange if we already have transparency data available.)
There is also a more general need for scripts to be able to discover more about the transparent areas of a photo image; at the moment, there is no access at all to that information at the script level.
To get around this problem, the data member validRegion of the PhotoMaster