Tk Source Code

View Ticket
Login
Ticket UUID: 220580
Title: Support line styles in Windows X emulation layer
Type: RFE Version: None
Submitter: welch Created on: 2000-10-31 23:47:21
Subsystem: 68. Win Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-28 05:44:15
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-27 22:44:15
Description:
OriginalBugID: 2578 RFE
Version: 8.0.4
SubmitDate: '1999-08-18'
LastModified: '1999-12-13'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Windows NT
Machine: X86
FixedDate: '1999-12-13'
FixedInVersion: 8.3b1


Name:

Brian Griffin


CVS:

tkWinDraw.c 1998/09/14 18:24:00     1.2


CustomShell:

I have several patches; don't recall them all.  Some are my own which I've submitted previously.


Comments:

I have only tested LineOnOffDash of signle pixel wide lines.  Lines

    wider than 1 pixel uses different code.


ReproducibleScript:

Using these emulated X calls on Windows:

    XSetLineAttributes( display, gc, line_width, line_style, cap_style,

    join_style);

    XDrawLine( display, d, gc, x1, y1 , x2, y2 );


    You'll find that the line_style argument is ignored.  All lines are draw

    as LineSolid (a.k.a. PS_SOLID).


DesiredBehavior:

LineOnOffDash and LineDoubleDash should also be supported.


Patch:

cvs diff -c tkWinDraw.c

Index: tkWinDraw.c

===================================================================

RCS file: /cvsroot/tk/win/tkWinDraw.c,v

retrieving revision 1.2

diff -c -r1.2 tkWinDraw.c

*** tkWinDraw.c 1998/09/14 18:24:00     1.2

--- tkWinDraw.c 1999/08/12 19:21:21

***************

*** 743,748 ****

--- 743,750 ----

      RECT rect;

      HPEN oldPen;

      HBRUSH oldBrush;

+     int oldBkMode;

+     COLORREF oldBkColor;

      POINT *winPoints = ConvertPoints(points, npoints, mode, &rect);


      if ((gc->fill_style == FillStippled

***************

*** 838,843 ****

--- 840,847 ----


        SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE

                : WINDING);

+       oldBkMode = SetBkMode(dc, TRANSPARENT);

+       oldBkColor = SetBkColor(dc, gc->background);


        (*func)(dc, winPoints, npoints);


***************

*** 913,921 ****

                style |= PS_JOIN_BEVEL;

                break;

        }

        pen = ExtCreatePen(style, gc->line_width, &lb, 0, NULL);

      } else {

!       pen = CreatePen(PS_SOLID, gc->line_width, gc->foreground);

      }

      RenderObject(dc, gc, points, npoints, mode, pen, Polyline);

      DeleteObject(pen);

--- 917,939 ----

                style |= PS_JOIN_BEVEL;

                break;

        }

+       switch (gc->line_style) {

+       case LineSolid:      style |= PS_SOLID; break;

+       case LineOnOffDash:  style |= PS_DOT; break;

+       case LineDoubleDash: style |= PS_DASH; break;

+       default:             style |= PS_SOLID; break;

+       }

        pen = ExtCreatePen(style, gc->line_width, &lb, 0, NULL);

      } else {

!       int style;

!       switch (gc->line_style) {

!       case LineSolid:      style = PS_SOLID; break;

!       case LineOnOffDash:  style = PS_DOT; break;

!       case LineDoubleDash: style = PS_DASH; break;

!       default:             style = PS_SOLID; break;

!       }

!

!       pen = CreatePen(style, gc->line_width, gc->foreground);

      }

      RenderObject(dc, gc, points, npoints, mode, pen, Polyline);

      DeleteObject(pen);


PatchFiles:

tkWinDraw.c




Changed to RFE, because at the moment we don't require this in Tk
(which doesn't mean we won't include it after further analysis). 
-- 08/20/1999 hobbs
8.3b1 has the dash part of the dash patch. 
-- 12/13/1999 hobbs