Oops - I missed out some vital pixel region initialisation. On Friday, 6 Apr 2001, Austin Donnelly wrote: > gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2); > > for (y = y1; y < y2; y += tile_width - (y % tile_width)) > { > for (x = x1; x < x2; x += tile_width - (x % tile_width)) > { /* set up the source and dest regions */ gimp_pixel_rgn_init (&src_rgn, drawable, x, y, x_step, y_step, FALSE/*dirty*/, FALSE/*shadow*/); gimp_pixel_rgn_init (&dest_rgn, drawable, x, y, x_step, y_step, TRUE/*dirty*/, TRUE/*shadow*/); > /* process the image in tile-sized regions */ > for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn); > pr != NULL; > pr = gimp_pixel_rgns_process (pr)) > { > src_row = src_rgn.data; > dest_row = dest_rgn.data; > > for (row = 0; row < src_rgn.h; row++) > { > src = src_row; > dest = dest_row; > > for (col = 0; col < src_rgn.w; col++) > { > > /* do stuff with src[0..bpp] and dest[0..bpp] */ > > src += src_rgn.bpp; > dest += dest_rgn.bpp; > } > > src_row += src_rgn.rowstride; > dest_row += dest_rgn.rowstride; > } > } > } > }