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: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7696) Re: Re: (PR#7637) Problem with line_width=2 [take 4]
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Mar 2004 11:37:45 -0800
Reply-to: rt@xxxxxxxxxxx

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

Raimar Falke wrote:
> <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.

Right, but if you want to make 2 such calls you have to specify how 
they're placed relative to each other.  This "defines" the size-2 line.

When drawing a sized-2 line around a tile, we draw 4 lines:

   (x0,y0) -> (x0, y0+H-1)
   (x0,y0) -> (x0+W-1, y0)
   (x0,y0+H-1) -> (x0+W-1, y0+H-1)
   (x0+W-1,y0) -> (x0+W-1, y0+H-1)

but these lines should all be inset.  So instead of subtracting off 1 we 
should subtract off 2 in most cases.  This is a situation where drawing 
individual lines may give some advantage, because the inset does not 
match exactly with the 2-line definition: think of it as two rectangles, 
one inside the other, rather than as 4 double-width lines.  This is more 
likely to make a difference in iso-view, where if you draw a 
double-width line you may end up going 1 pixel over into the adjacent tile.

But I'm not even sure the two-line method would work in iso-view.  Say 
you draw two lines, from

   (x0,     y0 + H / 2) -> (x0 + W / 2, y0)
   (x0 + 1, y0 + H / 2) -> (x0 + W / 2, y0 + 1)

can you guarantee that these lines will give the results you want?  Is 
it possible there will be a hole between the two lines?  How could we 
convince ourselves otherwise?

I think the solution civ3 used was to provide sprites for the lines. 
This allowed the lines to curve over hills and mountains (it took a 
number of sprites, of course).

jason




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