/** * im_draw_smudge: * @image: image to smudge * @left: area to smudge * @top: area to smudge * @width: area to smudge * @height: area to smudge * * Smudge a section of @image. Each pixel in the area @left, @top, @width, * @height is replaced by the average of the surrounding 3x3 pixels. * * This an inplace operation, so @image is changed. It does not thread and will * not work well as part of a pipeline. On 32-bit machines it will be limited * to 2GB images. * * See also: im_draw_line(). * * Returns: 0 on success, or -1 on error. */ int im_draw_smudge( VipsImage *im, int left, int top, int width, int height ) { Rect area, image, clipped; IMAGE *t[2]; area.left = left; area.top = top; area.width = width; area.height = height; image.left = 0; image.top = 0; image.width = im->Xsize; image.height = im->Ysize; im_rect_intersectrect( &area, &image, &clipped ); if( im_rect_isempty( &clipped ) ) return( 0 ); if( !blur ) { blur = im_create_imaskv( "im_draw_smudge", 3, 1, 1, 4, 1 ); blur->scale = 6; } if( !(t[0] = im_open( "im_draw_smudge", "p" )) ) return( -1 ); if( !(t[1] = im_open_local( t[0], "im_draw_smudge", "p" )) || im_convsep( im, t[0], blur ) || im_extract_area( t[0], t[1], clipped.left, clipped.top, clipped.width, clipped.height ) || im_draw_image( im, t[1], clipped.left, clipped.top ) ) { im_close( t[0] ); return( -1 ); } im_close( t[0] ); return( 0 ); }
int im_insertplace( IMAGE *main, IMAGE *sub, int x, int y ) { return( im_draw_image( main, sub, x, y ) ); }