AnonMiraj / fig

FIG (Fortran Intuitive Graphics)
MIT License
22 stars 2 forks source link

Method for clearing the drawing #31

Closed johandweber closed 2 weeks ago

johandweber commented 3 weeks ago

I have added a method clear to the drawing class that removes all shapes with the exception of the background.

This is done by saving the background color of the image, than de-allocating the array this shapes and re-adding the background.

Note: I am not sure whether this approach is method is completely memory-save, as it acts on an array of polymorphic objects.
It is likely to be OK as log a s the "child" shapes have a fixed size, but it might be insufficient if newer ones (polylines ect. ) contain allocatable/pointer elements.

@perazz

johandweber commented 3 weeks ago

Thank you.

Maybe a "Null-Operation" would be useful.

I think that updating an existing draweing in non-interactive applications like video creation (I do not think that video creation is far off the scope of this library. At the end a video is just a series of images and while we will not write a MPEG codec in pure Fortran in the near future, it is always possible to write a series of image files or a stream of data in a pipe and let external tools like FFMPEG do the rest. )

AnonMiraj commented 2 weeks ago

Why did you close it? I was about to merge it after fixing the conflict.