Page 1 of 1

Canvas elements recreation performance.

Posted: 12 Dec 2013, 15:50
by ironic
Hi!

I am planning to use NoesisGui for an application which includes 2d shapes editing. For it I will probably use Canvas and put elements on it. Now it is important for me to know whether there would be a big overhead if I recreate all Children of canvas on every update. Speaking numbers, I expect to have a Canvas with no more than 1000 elements (mostly texts and paths with solid and possibly some gradient colors).

So three questions are:
Is Canvas suitable for such task?
Is there a chance that recreating all children will be performing quickly enough on tablets?
If not, then would it help if I only update shapes that actually change?

Thanks!

Re: Canvas elements recreation performance.

Posted: 13 Dec 2013, 10:59
by sfernandez
Is Canvas suitable for such task?
Canvas is only the container of elements. It determines the position of its children using their Canvas.Left/Right and Canvas.Top/Bottom properties. Children size does not depend on Canvas size, so you have to set the dimensions of the children manually.
Is there a chance that recreating all children will be performing quickly enough on tablets?
If not, then would it help if I only update shapes that actually change?
Whenever is possible, you should only modify the properties that need to change, using the same objects and resources. Otherwise, lots of new objects would be created each frame, and you will lose everything that gets cached in the render tree.