Package: tcllib, Version: CVS HEAD
ico -
Reading and writing windows
icons
package require Tcl 8.4 package require ico ? 0.3 ? ::ico::getIconList file ? option value... ? ::ico::getIcon file index ? option value... ? ::ico::writeIcon file index depth data ? option value... ? ::ico::copyIcon file index file2 index2 ? option value... ? ::ico::EXEtoICO file file2 ::ico::clearCache ? file ? ::ico::transparentColor image color ::ico::Show file ? option value... ?
Type | Name | Mode |
---|---|---|
fileName | file | in |
integer | index | in |
This is the 0-based index of the icon to write. When writing to an EXE, DLL, or ICL file you may only overwrite existing icons with an icon of the same dimensions and color depth. When writing to an ICO, index may be one greater than the last icon. This will append a new icon to the file. When writing to an ICO, index will accept end. This will also cause the new icon to be appended to the file. When writing the other types end will refer to the last existing icon. | ||
integer | depth | in |
This argument must have a value of 1, 4, 8, 24, or 32. If data has more colors than the color depth allows an error will be generated. | ||
options | data | in |
This argument is either a list of colors in the format returned by ::ico::getIcon -format colors or the name of a Tk image. |
button .explore -image [::ico::getIcon explorer.exe 0 -name explore] set i [lsearch [::ico::getIconList tclkit.exe] {32 32 8}]] set colorlist [::ico::getIcon tclkit.exe $i -format colors -type EXE]
Icons of 8bpp or lower must include black in the pallete, this means if your icon does not have black in it, you will need to leave a color free so that it may be included by writeIcon.
There is currently no way to read alpha channel information from 32bpp icons.
Tk images do not have an alpha channel so the only way to write a true 32bpp icon is from a color list. writing a 32bpp icon from a Tkimage is identical to writing a 24bpp icon.
button .explore -image [::ico::getIcon explorer.exe 0 -name explore] set i [lsearch [::ico::getIconList tclkit.exe] {32 32 8}]] set colorlist [::ico::getIcon tclkit.exe $i -format colors -type EXE]