First I want to thank you Sven for your so pleasant help.

> there are several flaws in your plug-in (see below) but the main
> problem is that you are trying to access data outside the
> drawable.

Yes, I needed time to understand it, but I finally understood.

> - average() and variency both use a wrong index into the data
>   array thus accessing the wrong data. Your loops should go from
>   0 to width/height, not from x to x + width, resp. y to y + height

Ok for this. I couldn't know.

>   and using region->rowstride and region->bpp here does not make
>   sense.

Why doesn't it make sense here? Are they undefined here or is this just 
because I'm only working on graylevels and only access data byte per 

I corrected some other hints you gave me. Not added tile cache for the 

I have another question : the plugin currently do not work for the 
reason that my writes in the output image are taken into account (or 
seem not to... ;-)
Here are the incriminated lines :
                 /* Computes the variency and determine whether the pixel is
            part of a region or not. Colorify the output image */
                 if(variency(&window) > MAX_VARIENCY)
                        fprintf(stderr, "Setting 0 in pixel %d,%d\n", col, row);
                        gimp_pixel_rgn_set_pixel(&outputRegion, &blackValue, col, row);
                        gimp_pixel_rgn_set_pixel(&outputRegion, &whiteValue, col, row);
In my mind, my output image should be only black and white but I obtain 
many effects that are not really unlookable, but they are not the 
waited result =) ;-)

I have uploaded the last version here (if anyone need to see the code 

"Le temps ne fait rien  l'affaire, quand on est con, on-est-con !"
-- Georges Brassens
Gimp-developer mailing list

Reply via email to