AnonMiraj / fig

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

Method for clearing the drawing #31

Closed johandweber closed 5 months ago

johandweber commented 5 months 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 5 months 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 5 months ago

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