Fix for tclkit custom icon replacement NOT FOUND error, final solution
Patrick <[email protected]> Fri, 5 Mar 2010 10:25:19 -0800 (PST)
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <0f7dd4f5-96dc-4ce9-858a-550077c56f1a@j27g2000yqn.googlegroups.com> |
posting here as well as comp.lang.tcl. Created a issue as well.
I know this has been an ongoing issue, I finally rolled up my sleeves
and dug into the sdx code. I figured out what the underlying problem
and solution is for replacing custom icons using tclkit / sdx to wrap
starkits. Pat Thoyts, please consider putting this fix in the sdx code
as soon as you can.
The problem:
when replacing the tcl icon with a custom icon in a starpack using the
latest tclkit (8.5.8), you will likely see the following messages:
icon 48x48/256: NOT SAME SIZE
icon 32x32/256: NOT SAME SIZE
icon 16x16/256: NOT SAME SIZE
icon 48x48/256: NOT SAME SIZE
icon 32x32/256: NOT SAME SIZE
icon 16x16/256: NOT SAME SIZE
icon 48x48/256: replaced
icon 32x32/256: replaced
icon 16x16/256: replaced
This causes the icon in your starkit exe to only be partially replaced
(3 of the 9 images). I got to thinking, why does the 256 keep
repeating.
The explanation:
I unwraped the sdx kit and took a look. It turns out that in the sdx
code, the 256 represents the number of colors. However while opening
the ico file and inspecting the contents, if the sdx wrapping code
sees 0 it sets the number of colors to search for 256. However,
according to what I found on wikipedia 0 represents true color, which
of course Vista / 7 (and I presume at least XP / 2003) support. I
suppose this was a holdover from when the starpack solution was first
created.
The starpack code create an array of images found in both the original
icon and the new icon with the array element name of width X height X
numberofcolors. It then tries to match the array in the original with
the same one in the new icon file. If it finds one it checks the size.
Since the number of colors is incorrectly set to 256 for those above 8
bits, the sizes will not match.
The solution:
1. unwrap sdx.kit
2. navigate to the wrap.tcl file
3. in the procedure decICO, change the line
lappend result ${w}x${h}/$cc $image
to
lappend result ${w}x${h}/$bc $image
(bc is the bits per pixel ... http://en.wikipedia.org/wiki/ICO_%28file_format%29
). We'll use the bits per pixel as part of the array index as opposed
to the number of colors.
4. rewrap sdx.kit
5. rewrap your application.
You will see the following output when you rewrap your app (assuming
you have the correct images in your ico file:
customizing tclkit.ico in executable
icon 64x64/32: replaced
icon 48x48/32: replaced
icon 32x32/32: replaced
icon 24x24/32: replaced
icon 16x16/32: replaced
icon 48x48/24: replaced
icon 32x32/24: replaced
icon 24x24/24: replaced
icon 16x16/24: replaced
icon 48x48/8: replaced
icon 32x32/8: replaced
icon 24x24/8: replaced
icon 16x16/8: replaced
I hope this ends this longstanding issue once and for all. Pat, please
let me know what you think.
Thanks,
Patrick
--
You received this message because you are subscribed to the "starkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/starkit?hl=en