Skip to content

Commit acfc6f4

Browse files
committed
Fixed bug introduced by removing Color module (C# only)
1 parent 9846883 commit acfc6f4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

CSharp/Examples/RectClip/Main.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ public static bool RestoreBackup(string filename, out Paths64 sub, out Paths64 c
6363
return true;
6464
}
6565

66-
public static void DoRandomPoly(bool loadPrevious = false)
66+
public static uint RandomColor(Random rc)
67+
{
68+
return (uint) (rc.Next() | 0xBF000000);
69+
}
70+
71+
public static void DoRandomPoly(bool loadPrevious = false)
6772
{
6873
Random rand = new();
6974
Paths64 sub = new Paths64(), clp = new Paths64(), sol;
@@ -97,11 +102,10 @@ public static void DoRandomPoly(bool loadPrevious = false)
97102
double cumFrac = frac;
98103
foreach (Path64 path in sol)
99104
{
100-
Colors.Color32 c = Colors.Rainbow(cumFrac, 64);
105+
uint c = RandomColor(rand);
101106
cumFrac += frac;
102-
Colors.Color32 c2 = new Colors.Color32(
103-
(c.color & 0xFFFFFF) | 0x20000000);
104-
svg.AddClosedPath(path, c2.color, c.color, 1.2);
107+
uint c2 = (c & 0xFFFFFF) | 0x20000000;
108+
svg.AddClosedPath(path, c2, c, 1.2);
105109
}
106110
}
107111
svg.SaveToFile("../../../rectclip.svg", 800, 600, 20);

0 commit comments

Comments
 (0)