NAME
im_render, im_render_fade, im_cache - make image in the background
SYNOPSIS
#include <vips/vips.h>
int im_render_fade( IMAGE *in, IMAGE *out, IMAGE *mask,
int width, int height, int max,
int fps, int steps,
int priority,
void (*notify)( IMAGE *, Rect *, void * ), void *client );
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_fade(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 (a value of -1 for max means any number of
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_fade(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 notify
function will be called by a background thread, so you will usually
need to implement some mechanism to interrupt your main thread and
update.
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. If mask
is NULL, then no mask image is written.
If steps is greater than zero, then pixels in mask are moved between 0
and 255 as tiles age in that many steps. The fps parameter sets how
many times per second the notify function is called to indicate that an
updated tile is ready.
If priority is zero, then the render will only run when the system is
idle, and only a few renders will run at any time. Higher values will
cause the render to happen more quickly.
im_cache(3) is a convenience function for im_render_fade(3) that caches
image pixels synchronously. If you ask for an area not in the cache,
execution blocks until the area has been calculated.
im_render(3) is deprecated: it is the old interface to the render
function, before the fps and steps parameters were added.
RETURN VALUE
The function returns 0 on success, and non-zero on error, setting
im_error().
SEE ALSO
im_prepare(3)
AUTHOR
J Cupitt, 2003
5 October 2003 IM_RENDER(3)