The International Simutrans Forum

 

Author Topic: Network line colors  (Read 1392 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Network line colors
« on: April 06, 2015, 09:56:10 PM »
Go ahead, I am really open to improvements. I just fear that everyone has a different tast (and monitor) and hence would consider something different better.

Offline yorkeiser

  • *
  • Posts: 107
  • Beer guru
  • Languages: IT EN FR
Re: Network line colors
« Reply #1 on: April 06, 2015, 10:40:20 PM »
First of all hi prissi, nice to hear again from you (that's my fault, have had little time to join the forum due to life happenings).
When we talked about and then developed net graphs this question already arose: often colors assigned to lines avoid lines to be distinguishable, cause of colors being too similar sometimes for near lines. I can't tell you what's the solution cause I don't remember the code; based on my rememberings, minimap colors are just 256, so it's not easy to give player a wide color variety. I also don't remember if minimap palette colors are already use for other things (icons, map...), but i really suspect they are.
The basic idea would be to:
1) assign to the line a color that isn't used by a near line
2) In addiction, line colors would have to be contrasting on the map (0xFF0000 contrasts well, 0x777777 not...) Easy to tell, I know, I also remember difficulties when worked on that.

Thinking about a solution...
1) every line could be assigned a "geographical" coefficient (x,y), e.g. calculated as the average of its stations' (x,y) coordinates (of course other metrics could give better results). So lines' array could be ordered by this coefficient and given a preassigned color that could guarantee the right distance between lines.
By example a NW line would have low x and y average values, while a NE  line would have low y and hi x values. If the colors array would be really different among adiacent cells, near lines would have different colors on minimap.

E.g.
Line NW1 - minimum (x,y) coefficient -> becomes line[0] and is assigned color[0]=0xFF0000
Line NW2 - line[1] - color[1]=0x00FF00
Line NW3 - line[2] - color[2]=0x0000FF
Line NW4 - line[3] - color[3]=0x... (adiacent colors are really different)

I hope you understood me, my english often has some lacks :)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network line colors
« Reply #2 on: April 07, 2015, 08:53:13 PM »
After recent renovation of the drawing system RGB colors can be used, since the lines are drawn as an overlay and could use "display_direct_line_rgb". Even though if the minimap is still 240 colors.