[NTG-context] couple of metafun questions

Mojca Miklavec mojca.miklavec.lists at gmail.com
Wed Aug 2 23:56:44 CEST 2006

On 8/2/06, Thomas A. Schmitz wrote:
> 3. Is it possible to get a line/arrow dashed in two different colors,
> like red and blue?

Just out of curiosity I tried the following:

picture dp;
draw dashpattern(on 2 off 6) scaled 5pt withcolor blue;
draw dashpattern(off 4 on 2 off 2) scaled 5pt withcolor red;
dp := currentpicture;

draw origin--(5cm,0) dashed dp;

But of course "! Picture is too complicated to use as a dash pattern."
So you have to draw the path twice with different color and pattern
(you can write a macro for it of course if you need it often).

	pickup pencircle scaled 2pt;
	picture dp[];
	dp[1] := dashpattern(on 2 off 6) scaled 3pt;
	dp[2] := dashpattern(off 4 on 2 off 2) scaled 3pt;

	path p;	p := (origin .. (2,1) .. (3,-1) .. (5,0)) scaled 3cm;

	draw p dashed dp[1] withcolor blue;
	draw p dashed dp[2] withcolor red;


More information about the ntg-context mailing list