private Task <List <Tuple <Geometry, Color> > > CreateGeometries(float time) { return(Task.Run(() => { ControlPointArray temp = Points; int count = Points.Count; List <Tuple <Geometry, Color> > geometries = new List <Tuple <Geometry, Color> >(); for (int index = 0; index < count - 1; ++index) { float hue = (_baseHue + (index + 1) / (float)(count + 1)) % 1; Vector4 hsv = new Vector4(hue, 1.0f, 1f, 1); Color rgba = XMath.ColorHsvToRgb(hsv); ControlPointArray array = temp.Reduce(time); geometries.Add(new Tuple <Geometry, Color>(array.CreateGeometry(_factory), rgba)); temp = array; } return geometries; })); }
private Task CreateGeometries(float time) { Task task = new Task(() => { var temp = Points; int count = Points.Count; _geometries = new List <Tuple <Geometry, Color> >(); for (int index = 0; index < count - 1; ++index) { float hue = (_baseHue + (index + 1) / (float)(count + 1)) % 1; Vector4 hsv = new Vector4(hue, 1.0f, 1f, 1); Color rgba = XMath.ColorHsvToRgb(hsv); var array = temp.Reduce(time); _geometries.Add(new Tuple <Geometry, Color>(array.CreateGeometry(Direct2DFactory), rgba)); temp = array; } }); task.Start(); return(task); }