public async void AsyncRun(Color[] colors) { if (this.State != RunnerState.Wait) { return; } this.State = RunnerState.Runnning; var clusterCount = this.clusterCount; var iteration = this.iteration; var scaleUp = this.scaleUp; var result = await Task.Run(() => TypicalColorsPicker.PickUp(colors, clusterCount, iteration, scaleUp).Select(e => e.Color).ToArray() ); this.typicalColors = result; this.State = RunnerState.Finish; }
public void AsyncRun(RenderTexture texture) => this.AsyncRun(TypicalColorsPicker.GetColors(texture));