i am stuck with a personal code murgaLua 0.7.5 (OS Linux Lubuntu LTS, but it should work in Windows) that captures in a fltk graphic window (created by the code) a diagram image and writes it in png format. Unfortunately, this MurgaLua-specific PNG image writing function, saveAsPng(), seems slower than the calculation of the histogram table, and as I have several diagrams to write, either I have a "core dumped" message, or only the last diagram is saved, or, and this is the current solution, a fltk "modal window" is displayed to delay the operations, and I get the different images on disk. The problem is the volume: I want to write an automatic report with potentially more than 500 diagrams! The test data file is an OpenData file of more than 450 MB, downloadable here:
And the complete murgaLua code is here https://github.com/mterras01/murgaLua/blob/main/statsoncsv_next2.lua
Following function is fully working
function read_Image()
pwindow:make_current()
Fl:check()
Fl:flush()
imageString = fltk.fl_read_image(0, 0, width_pwindow, height_pwindow)
Fl:check()
Fl:flush()
image2 = fltk:Fl_RGB_Image(imageString, width_pwindow, height_pwindow, 3, 0)
Fl:check()
Fl:flush()
fileName = title .. ".png"
image2:saveAsPng(fileName)
end
It is called from a for-loop (successive images). (I know murgaLua is an old language (i'm 59 old) written by John de Murga).
i successfully can save all my charts with
Fl:check()
pwindow:show()
pwindow:redraw()
Fl:flush()
pwindow:set_modal()
if fltk:fl_choice("Save Charts or not ?", "No", "Yes", nil) == 1 then
read_Image()
end
pwindow:set_non_modal()
but have to click each time to save. Not the good way to build a 500 images report.
So i found answer to my question. Again, thanks to Albrecht Schlosser (danke sehr!), for its suggestion. It seems that (one) solution was to open a countdown-autoclosing-fltk-modal-window that makes "synchro" graphic (draw charts) & computing tasks (read-convert and save images-as-a-file for each charts). This fully works with Linux OS, but there is a 45-sec-lag with Windows (in today version, work in progress, if interested, see my github)... It's more easy to write this script with python, but murgaLua is such a GEM.Please,please developpers, consider about updating this GEM !