Table of Contents

Name

im_render, im_cache - make image in the background

Synopsis

#include <vips/vips.h>

int im_render( IMAGE *in, IMAGE *out, IMAGE *mask,
int width, int height, int max,

void (*notify)( IMAGE *, Rect *, void * ), void *client );

int im_cache( IMAGE *in, IMAGE *out,
int width, int height, int max );

Description

im_render(3) behaves rather like im_copy(3) between images in and out, except that it keeps a cache of computed pixels. This cache is made of up to max tiles, and each tile is of size width by height pixels. Each cache tile is made with a call to im_prepare_thread(3) , so cache tile calculation will be accelerated on multi-CPU machines. If image in represents a large computation, im_render(3) can save a lot of time.

If the notify parameter points to a function, then tiles are not calculated immediately, but are added to a job list and calculated as CPU becomes available. When a tile has been calculated, the notify function is passed the image which was being cached, the area of the image which is now available, and a client pointer.

The mask image is a one band uchar image the same size as out, which has 255 for every pixels which is in the cache and 0 everywhere else. You should not read pixels from mask after out has been closed.

im_cache(3) is a convenience function for im_render(3) that caches image pixels synchronously. If you ask for an area not in the cache, execution blocks until the area has been calculated.

Return Value

The function returns 0 on success, and non-zero on error, setting im_errormsg().

See Also

im_prepare(3)

Author

J Cupitt, 2003


Table of Contents