Dont Dispose of Builder/Create Clone of existing command queue or rendering until condition is met

I am trying to do something do something very unorthodox here, I have a algorithm that is being visualized step by step at a press of a button. While executing the step I have a custom Command Builder to grab a lot of visualization data which I then render by calling dispose.

The problem I am trying to solve is, I want to have the drawing constantly visible until the next step is trigger where all the drawings will be re rendered.

I tried using WithDuration but its not a fixed step (its user decided). So I am trying to effectively create a builder, and have a some sort on demand render method that does not dispose of the builder, or in worse case scenario a way to clone the builder before it being dispose, so I can just clone, dispose similar to double buffering.

Do you have a better approach/way of doing this?

Hi

This is actually surprisingly easy, it’s just undocumented.

var redrawScope = DrawingManager.GetRedrawScope();
var draw = DrawingManager.GetBuilder(redrawScope);
draw.Line(...);
draw.Dispose();

// wait any amount of time

// Stop drawing
redrawScope.Dispose();

Ah man, I was looking at the code saw that method and didnt pursue!

Thank you, this is exactly what I need :slight_smile:

1 Like