This is not necessarily the current version of this TIP.
|Title:||Access (via tkInt) to Tk Photo Image Transparency|
|Version:||$Revision: 1.2 $|
|Author:||Donal K. Fellows <fellowsd at cs dot man dot ac dot uk>|
|Created:||Wednesday, 22 November 2000|
|Keywords:||Tk, photo, transparency, internal, access|
It is useful for some extensions 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 in a way that can be kept backwardly compatible 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.)
To get around this problem, the data member validRegion of the PhotoMaster structure needs to be made available by some mechanism. There are two ways of doing this:
Placing the PhotoMaster structure, or some version of it, in generic/tkInt.h, or
Creating a function to access the data member.