Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#7696) Re: Re: (PR#7637) Problem with line_width=2
Home

[Freeciv-Dev] Re: (PR#7696) Re: Re: (PR#7637) Problem with line_width=2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#7696) Re: Re: (PR#7637) Problem with line_width=2 [take 4]
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Wed, 10 Mar 2004 11:02:20 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7696 >

On Tue, Mar 09, 2004 at 10:37:36AM -0800, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7696 >
> 
> Raimar Falke wrote:
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7637 >
> 
> >>I think we should define it, and leave it up to the GUI implementation 
> >>to conform.  If it doesn't conform it's probably not too bad.
> >>
> >>Also, I take back that it's impossible to conform.  If the GUI author 
> >>knows how his library works he can implement the standard by translating 
> >>the origin by a pixel or so.
> > 
> > How do you define it? Something like "The second pixel is always to
> > the right or bottom of the primary one?"
> > 
> > I think it is clearly easier to do multiple calls.
> 
> That's ridiculous.  You'd have to define it anyway before you could do 
> multiple calls.

It is well define for line_width=1.

> We should just look up the definition (in the gtk-2.x source code,
> most likely) and use that.  Other GUIs can either conform or end up
> with trivially different behavior.

man XCreateGC contains:

       The line-width
       is measured in pixels and either can be greater than or
       equal to one (wide line) or can be the special value zero
       (thin line).

       Wide lines are drawn centered on the path described by the
       graphics request.  Unless otherwise specified by the join-
       style or cap-style, the bounding box of a wide line with
       endpoints [x1, y1], [x2, y2] and width w is a rectangle
       with vertices at the following real coordinates:

       [x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
       [x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]

       Here sn is the sine of the angle of the line, and cs is
       the cosine of the angle of the line.  A pixel is part of
       the line and so is drawn if the center of the pixel is
       fully inside the bounding box (which is viewed as having
       infinitely thin edges).  If the center of the pixel is
       exactly on the bounding box, it is part of the line if and
       only if the interior is immediately to its right (x
       increasing direction).  Pixels with centers on a horizon­
       tal edge are a special case and are part of the line if
       and only if the interior or the boundary is immediately
       below (y increasing direction) and the interior or the
       boundary is immediately to the right (x increasing direc­
       tion).

It is the definition but not in a nice formal.

> Also if you rely on the implementation to be precise you run into a
> much bigger problem with border (dashed) lines.  Are we going to do
> the dashing ourselves?  Isn't this what graphics libraries are for?

The different guis can do different dashing. But if they use different
wide lines you draw into the adjacent tile.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Microsoft DNS service terminates abnormally when it recieves a response
  to a DNS query that was never made.
  Fix Information: Run your DNS service on a different platform."
    -- MS service information on bugtraq




[Prev in Thread] Current Thread [Next in Thread]