Top | Description | ![]() | ![]() | ![]() | ![]() |
int | (*VipsRegionWrite) () |
int | vips_sink_disc () |
int | vips_sink () |
int | vips_sink_tile () |
void | (*VipsSinkNotify) () |
int | vips_sink_screen () |
int | vips_sink_memory () |
void * | vips_start_one () |
int | vips_stop_one () |
void * | vips_start_many () |
int | vips_stop_many () |
VipsImage ** | vips_allocate_input_array () |
int | vips_image_generate () |
int | vips_image_pipeline_array () |
int | vips_image_pipelinev () |
These functions let you attach generate functions to imagesand ask for regions of images to be calculated.
int(*VipsRegionWrite) (VipsRegion *region
,VipsRect *area
,void *a
);
The function should write the pixels inarea
fromregion
.a
is thevalue passed intovips_sink_disc()
.
See also:vips_sink_disc()
.
intvips_sink_disc (VipsImage *im
,VipsRegionWrite write_fn
,void *a
);
vips_sink_disc() loops overim
, top-to-bottom, generating it in sections.As each section is produced,write_fn
is called.
write_fn
is always called single-threaded (though not always from the samethread), it's always given imagesections in top-to-bottom order, and there are never any gaps.
This operation is handy for making image sinks which output to things likedisc files. Things likevips_jpegsave()
, for example, use this to writeimages to files in JPEG format.
See also:vips_concurrency_set()
.
im | image to process | |
write_fn | called for every batch of pixels. | [scope call] |
a | client data. | [closure write_fn] |
intvips_sink (VipsImage *im
,VipsStartFn start_fn
,VipsGenerateFn generate_fn
,VipsStopFn stop_fn
,void *a
,void *b
);
Loops over an image.generate_fn
is called for every pixel inthe image, withthereg
argument being a region of calculated pixels.vips_sink()
isused to implement operations likevips_avg()
which have no image output.
Each set of pixels is sized according to the requirements of the imagepipeline that generatedim
.
See also:vips_image_generate()
,vips_image_new()
.
intvips_sink_tile (VipsImage *im
,int tile_width
,int tile_height
,VipsStartFn start_fn
,VipsGenerateFn generate_fn
,VipsStopFn stop_fn
,void *a
,void *b
);
Loops over an image.generate_fn
is called for everypixel in the image, withthereg
argument being a region of calculated pixels.
Each set of pixels istile_width
bytile_height
pixels (less at theimage edges). This is handy for things like writing a tiled TIFF image,where tiles have to be generated with a certain size.
See also:vips_sink()
,vips_get_tile_size()
.
intvips_sink_screen (VipsImage *in
,VipsImage *out
,VipsImage *mask
,int tile_width
,int tile_height
,int max_tiles
,int priority
,VipsSinkNotify notify_fn
,void *a
);
This operation rendersin
in the background, making pixels available onout
as they are calculated. Thenotify_fn
callback is run every time a newset of pixels are available. Calculated pixels are kept in a cache withtiles sizedtile_width
bytile_height
pixels and with at mostmax_tiles
tiles.Ifmax_tiles
is -1, the cache is of unlimited size (up to the maximum imagesize).Themask
image is a one-band uchar image and has 255 for pixels which arecurrently in cache and 0 for uncalculated pixels.
Only a single sink is calculated at any one time, though many may bealive. Usepriority
to indicate which renders are more important:zero means normalpriority, negative numbers are low priority, positive numbers highpriority.
Calls tovips_region_prepare()
onout
return immediately and holdwhatever iscurrently in cache for thatVipsRect (checkmask
to see which parts of theVipsRect are valid). Any pixels in theVipsRect which are not incache are addedto a queue, and thenotify_fn
callback will trigger when those pixels areready.
Thenotify_fn
callback is run from one of the background threads. In thecallbackyou need to somehow send a message to the main thread that the pixels areready. In a glib-based application, this is easily done withg_idle_add()
.
Ifnotify_fn
isNULL
thenvips_sink_screen()
runs synchronously.vips_region_prepare()
onout
will always block until the pixels have beencalculated.
See also:vips_tilecache()
,vips_region_prepare()
,vips_sink_disc()
,vips_sink()
.
in | input image | |
out | output image. | [out] |
mask | mask image indicating valid pixels | |
tile_width | tile width | |
tile_height | tile height | |
max_tiles | maximum tiles to cache | |
priority | rendering priority | |
notify_fn | pixels are ready notification callback. | [scope call][nullable] |
a | client data for callback. | [closure notify_fn][nullable] |
intvips_sink_memory (VipsImage *im
);
Loops overim
, generating it to a memory buffer attached toim
. It isused by vips to implement writing to a memory buffer.
See also:vips_sink()
,vips_get_tile_size()
,vips_image_new_memory()
.
void *vips_start_one (VipsImage *out
,void *a
,void *b
);
Start function for one image in. Input image isa
.
See also:vips_image_generate()
.
intvips_stop_one (void *seq
,void *a
,void *b
);
Stop function for one image in. Input image isa
.
See also:vips_image_generate()
.
void *vips_start_many (VipsImage *out
,void *a
,void *b
);
Start function for many images in.a
is a pointer toaNULL
-terminated array of input images.
intvips_stop_many (void *seq
,void *a
,void *b
);
Stop function for many images in.a
is a pointer toaNULL
-terminated array of input images.
See also:vips_image_generate()
.
VipsImage **vips_allocate_input_array (VipsImage *out
,...
);
Convenience function --- make aNULL
-terminated array of input images.Use withvips_start_many()
.
See also:vips_image_generate()
,vips_start_many()
.
intvips_image_generate (VipsImage *image
,VipsStartFn start_fn
,VipsGenerateFn generate_fn
,VipsStopFn stop_fn
,void *a
,void *b
);
Generates an image. The action depends on the image type.
For images created withvips_image_new()
,vips_image_generate()
justattaches the start/generate/stop callbacks and returns.
For images created withvips_image_new_memory()
, memory is allocated forthe whole image and it is entirely generated usingvips_sink_memory()
.
For images created withvips_image_new_temp_file()
and friends, memory fora few scanlines is allocated andvips_sink_disc()
used to generate the image in small chunks. As eachchunk is generated, it is written to disc.
See also:vips_sink()
,vips_image_new()
,vips_region_prepare()
.
intvips_image_pipeline_array (VipsImage *image
,VipsDemandStyle hint
,VipsImage **in
);
Add an image to a pipeline.image
depends on all of the images inin
,image
prefers to supply pixels according tohint
.
Operations can set demand hints, that is, hints to the VIPS IO system aboutthe type of region geometry they work best with. For example,operations which transform coordinates will usually work best withVIPS_DEMAND_STYLE_SMALLTILE
, operations which work on local windows ofpixels will likeVIPS_DEMAND_STYLE_FATSTRIP
.
Header fields inimage
are set from the fields inin
, with lower-numberedimages inin
taking priority.For example, ifin
[0] andin
[1] both have an itemcalled "icc-profile", it's the profile attached toin
[0] that will end uponimage
.Image history is completely copied from allin
.image
will have the historyof all the input images.The array of input images can be empty, meaningimage
is at the start of apipeline.
VIPS uses the list of input images to build the tree of operations it needsfor the cache invalidation system.
See also:vips_image_pipelinev()
,vips_image_generate()
.
image | output image. | [out] |
hint | demand hint for | |
in |
| [array zero-terminated=1] |
intvips_image_pipelinev (VipsImage *image
,VipsDemandStyle hint
,...
);
Build an array and callvips_image_pipeline_array()
.
See also:vips_image_generate()
.