On Tue, Jun 11, 2013 at 1:32 AM, Alessandro Francesconi < alessandrofrancesconi@xxxxxxx> wrote: > Hello, I'm starting to write a GIMP plugin and I'm facing the problem of > "pixel-per-pixel" algorithms and their speed. > Without going on details, my algorithm should take every pixel in the > image and for each one it must check its 24 neighbours, it does some simple > calcs and finally it set a new color for the pixel. > > How to speed-up the execution? I tried with the easiest approach with a > classic "for-in-for" loop but the computation is really slow. Looking > around, I've seen some GIMP functions like: > > gimppixelfetcher — Functions for operating on pixel regions. > gimppixelrgn — Functions for operating on pixel regions. > gimpregioniterator — Functions to traverse a pixel regions. > All of the above functions are considered deprecated; even when developing a GIMP plug-in and not a GEGL operation you would be encouraged to use GeglBuffer APIs (search for "gegl" in gimp's plug-in directories.). Though for a filter plug-in like you describe, the most proper way to do it now and for the future is to write a GeglOperation that derives from the provided GeglOperationAreaFilter like for instance: https://git.gnome.org/browse/gegl/tree/operations/common/noise-spread.c you'd probably want to fetch the entire neighborhood of the rectangular region being processed though; rather than doing like that particular plug-in which gegl_buffer_get's pixels one by one. /pippin _______________________________________________ gimp-developer-list mailing list gimp-developer-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gimp-developer-list