| Description: |
OriginalBugID: 4617 Bug
Version: 8.3
SubmitDate: '2000-03-27'
LastModified: '2000-03-30'
Severity: SER
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: All Windows
FixedDate: '2000-03-30'
FixedInVersion: 8.3.1
Name:
Jan Nijtmans
ReproducibleScript:
pack [canvas .c]
.c create lin 10 10 100 100 -dash.
ObservedBehavior:
When drawing dashed lines on the canvas, the parts that are supposed to be transparent are in fact white. This is a long-standing
bug in the dash-patch or - actually - a bug in the X11 emulation layer, affecting Windows only. This bug never affected Tk in
earlier versions because there didn't exist partially transparant canvas items.
Because of my lack of experience with the win32 api, I was not able to fix this earlier. However now I finally spent some
time to investigate it. Here is the fix I came up with.
Patch:
*** win/tkWinInt.h.orig Mon Mar 27 15:15:48 2000
--- win/tkWinInt.h Mon Mar 27 15:21:40 2000
***************
*** 48,53 ****
--- 48,54 ----
typedef struct TkWinDCState {
HPALETTE palette;
+ int bkmode;
} TkWinDCState;
/*
*** win/tkWinDraw.c.orig Mon Mar 27 15:07:56 2000
--- win/tkWinDraw.c Mon Mar 27 15:42:06 2000
***************
*** 173,178 ****
--- 173,179 ----
cmap = twdPtr->bitmap.colormap;
}
state->palette = TkWinSelectPalette(dc, cmap);
+ state->bkmode = GetBkMode(dc);
return dc;
}
***************
*** 199,204 ****
--- 200,206 ----
TkWinDCState *state;
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
+ SetBkMode(dc, state->bkmode);
SelectPalette(dc, state->palette, TRUE);
RealizePalette(dc);
if (twdPtr->type == TWD_WINDOW) {
***************
*** 864,869 ****
--- 866,872 ----
dc = TkWinGetDrawableDC(display, d, &state);
pen = SetUpGraphicsPort(gc);
+ SetBkMode(dc, TRANSPARENT);
RenderObject(dc, gc, points, npoints, mode, pen, Polyline);
DeleteObject(pen);
***************
*** 950,955 ****
--- 953,959 ----
dc = TkWinGetDrawableDC(display, d, &state);
pen = SetUpGraphicsPort(gc);
+ SetBkMode(dc, TRANSPARENT);
oldPen = SelectObject(dc, pen);
oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
SetROP2(dc, tkpWinRopModes[gc->function]);
***************
*** 1120,1125 ****
--- 1124,1130 ----
* it's only supported under Windows NT.
*/
+ SetBkMode(dc, TRANSPARENT);
Arc(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend);
} else {
brush = CreateSolidBrush(gc->foreground);
PatchFiles:
tkWinInt.h tkWinDraw.c
verified and patched as given for 8.3.1.
-- 03/30/2000 hobbs
|