| Ticket UUID: | 1467997 | |||
| Title: | [wm iconphoto] issues on Win XP | |||
| Type: | Bug | Version: | obsolete: 8.4.12 | |
| Submitter: | dgp | Created on: | 2006-04-10 21:28:40 | |
| Subsystem: | 68. Win Window Operations | Assigned To: | hobbs | |
| Priority: | 8 | Severity: | ||
| Status: | Closed | Last Modified: | 2007-06-13 00:19:30 | |
| Resolution: | Fixed | Closed By: | hobbs | |
| Closed on: | 2007-06-10 00:16:05 | |||
| Description: |
I've received reports of several problems with [wm iconphoto] on Windows XP. It's reported that the displayed icons have red and blue colors transposed. Perhaps a disagreement in the data format returned by Tk_PhotoGetImage() and that needed by the GetIcon() and other Windows calls? When two photo images are passed to [wm iconphoto], one 16x16 and one 32x32, it seems the 32x32 data is always used, and downsampled to produce 16x16 display. It's desired to have the 16x16 icon provided used instead. The [wm iconphoto] docs are missing on the core-8-4-branch. | |||
| User Comments: |
hobbs added on 2007-06-13 00:19:30:
Logged In: YES user_id=72656 Originator: NO The docs do not belong on the 8-4-branch because it is officially an 8.5 feature. The RGB issue was corrected in code. Nothing was done about which icon is picked. Looking at that logic, it depends on exact image sizes, and testing it by passing 16, 32 and 64px images, it does choose the right image. Thus, all closed. dgp added on 2007-06-12 21:08:23: Logged In: YES user_id=80530 Originator: YES several issues were reported here. Which one(s) are now fixed? hobbs added on 2007-06-10 07:16:05: Logged In: YES user_id=72656 Originator: NO Fixed in 8.4.16 and 8.5a7 mpc_janssen added on 2007-03-12 05:28:10: Logged In: YES
user_id=1463011
Originator: NO
Because it seems that the block.pixelPtr is shared with the actual image, this cannot be changed without changing the Tk image as well. Patch below makes a copy of the Tk pixel buffer, transposes R and B and frees the buffer again.
Also I have done a test with 16x16 and 32x32 icons (as returned by http://wiki.tcl.tk/17859) and then both the small icon (in the titlebar and taskbar) and the large icon (when using Alt-Tab) display correctly.
Patch:
> cvs diff tkWinWm.c
Index: tkWinWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/tkWinWm.c,v
retrieving revision 1.115
diff -r1.115 tkWinWm.c
4384a4385,4395
> {
> unsigned char * brgaPixelPtr;
> int idx;
> int bufferSize = height * width * block.pixelSize;
> brgaPixelPtr = ckalloc(bufferSize);
> for (idx = 0 ; idx < bufferSize ; idx+=4) {
> brgaPixelPtr[idx] = block.pixelPtr[idx+2];
> brgaPixelPtr[idx+1] = block.pixelPtr[idx+1];
> brgaPixelPtr[idx+2] = block.pixelPtr[idx+0];
> brgaPixelPtr[idx+3] = block.pixelPtr[idx+3];
> }
4387c4398,4399
< NULL, (BYTE *) block.pixelPtr);
---
> NULL, (BYTE *) brgaPixelPtr);
> ckfree(brgaPixelPtr);
4397a4410
> }
mpc_janssen added on 2007-03-12 04:21:24: Logged In: YES user_id=1463011 Originator: NO The issue here is that Tk stores colors as RGBA, whereas the internal Win32 structure (RGBQUAD) has the members order as BGRA. Therefore the blue and red colors are transposed. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki