RSS/Atom feed Twitter
Site is read-only, email is disabled

Selection offset

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Selection offset Joël-Alexis Bialkiewicz 24 Feb 09:47
Joël-Alexis Bialkiewicz
2006-02-24 09:47:49 UTC (about 18 years ago)

Selection offset

I currently have a problem with my plugin. On some pictures, it works on a part of the image right-shifted from the selection, instead of working on the selection itself. I commented out the algorithm part of the plugin, and it keeps having this effect.

Does anybody have an idea?

Here is the code and test procedure.

First I select a part of the image away for the border (it must always be the case, because of other reasons).

I initialize two regions : one for reading, and one for writing.

Here is the initialisation part.

gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2); width = x2-x1; height = y2-y1;
iWidth = gimp_drawable_width(drawable->drawable_id); iHeight = gimp_drawable_height(drawable->drawable_id); gimp_pixel_rgn_init (&rgn_mask, mask_drawable, 0, 0, iWidth, iHeight, FALSE, FALSE); gimp_pixel_rgn_init (&rgn_out, drawable, x1, y1, width, height, TRUE, TRUE);

Then, if I just read the whole first region with this loop

for(j=0; j
rhoIn[j*iWidth+i] *= sqrt(3.0*255.0*255.0); v = round( rhoIn[j*iWidth+i] * sinPsiIn[j*iWidth+i] ); r = round(sqrt( rhoIn[j*iWidth+i]*rhoIn[j*iWidth+i] * (1 - sinPsiIn[j*iWidth+i]*sinPsiIn[j*iWidth+i]) * sinPhiIn[j*iWidth+i]*sinPhiIn[j*iWidth+i] )); b = round(
sqrt(rhoIn[j*iWidth+i]*rhoIn[j*iWidth+i]-r*r-v*v) ); r=CLAMP(r,0.0,255.0); v=CLAMP(v,0.0,255.0); b=CLAMP(b,0.0 ,255.0);
rvbout[3*(i-x1)] = (guchar)r; rvbout[3*(i-x1)+1] = (guchar)v; rvbout[3*(i-x1)+2] = (guchar)b;

} gimp_pixel_rgn_set_row(&rgn_out, rvbout, x1, j, width); gimp_progress_update((gdouble)(j-y1)/(gdouble)height); }

I have this problem with some pictures, but not with others, which adds to the mystery.