inplace

inplace — in-place paintbox operations: flood, paste, line, circle

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <vips/vips.h>

int                 im_plotmask                         (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         PEL *ink,
                                                         PEL *mask,
                                                         Rect *r);
int                 im_smear                            (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         Rect *r);
int                 im_smudge                           (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         Rect *r);
int                 im_paintrect                        (IMAGE *im,
                                                         Rect *r,
                                                         PEL *ink);
int                 im_circle                           (IMAGE *im,
                                                         int cx,
                                                         int cy,
                                                         int radius,
                                                         int intensity);
int                 im_insertplace                      (IMAGE *main,
                                                         IMAGE *sub,
                                                         int x,
                                                         int y);
int                 im_fastline                         (IMAGE *im,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         PEL *pel);
int                 im_fastlineuser                     (IMAGE *im,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         int (fn) (),
                                                         void *client1,
                                                         void *client2,
                                                         void *client3);
int                 im_readpoint                        (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *pel);
int                 im_flood                            (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *ink,
                                                         Rect *dout);
int                 im_flood_blob                       (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *ink,
                                                         Rect *dout);
int                 im_flood_other                      (IMAGE *test,
                                                         IMAGE *mark,
                                                         int x,
                                                         int y,
                                                         int serial,
                                                         Rect *dout);
int                 im_flood_copy                       (IMAGE *in,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         PEL *ink);
int                 im_flood_blob_copy                  (IMAGE *in,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         PEL *ink);
int                 im_flood_other_copy                 (IMAGE *test,
                                                         IMAGE *mark,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         int serial);
int                 im_lineset                          (IMAGE *in,
                                                         IMAGE *out,
                                                         IMAGE *mask,
                                                         IMAGE *ink,
                                                         int n,
                                                         int *x1v,
                                                         int *y1v,
                                                         int *x2v,
                                                         int *y2v);

Description

These operations modify the input image. You can't easily use them in pipelines, but they are useful for paintbox-style programs.

Details

im_plotmask ()

int                 im_plotmask                         (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         PEL *ink,
                                                         PEL *mask,
                                                         Rect *r);

im_smear ()

int                 im_smear                            (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         Rect *r);

im_smudge ()

int                 im_smudge                           (IMAGE *im,
                                                         int ix,
                                                         int iy,
                                                         Rect *r);

im_paintrect ()

int                 im_paintrect                        (IMAGE *im,
                                                         Rect *r,
                                                         PEL *ink);

im_circle ()

int                 im_circle                           (IMAGE *im,
                                                         int cx,
                                                         int cy,
                                                         int radius,
                                                         int intensity);

im_insertplace ()

int                 im_insertplace                      (IMAGE *main,
                                                         IMAGE *sub,
                                                         int x,
                                                         int y);

Copy sub into main at position x, y. The two images must match in format, bands and coding.

This an inplace operation, so main is changed. It does not thread and will not work well as part of a pipeline.

See also: im_insert().

main :

main image

sub :

sub-image to insert

x :

position to insert

y :

position to insert

Returns :

0 on success, or -1 on error.

im_fastline ()

int                 im_fastline                         (IMAGE *im,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         PEL *pel);

im_fastlineuser ()

int                 im_fastlineuser                     (IMAGE *im,
                                                         int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2,
                                                         int (fn) (),
                                                         void *client1,
                                                         void *client2,
                                                         void *client3);

im_readpoint ()

int                 im_readpoint                        (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *pel);

im_flood ()

int                 im_flood                            (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *ink,
                                                         Rect *dout);

Flood-fill im with ink, starting at position x, y. The filled area is bounded by pixels that are equal to the ink colour, in other words, it searches for pixels enclosed by a line of ink.

The bounding box of the modified pixels is returned in dout.

This an inplace operation, so im 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_flood_blob(), im_flood_other(), im_flood_blob_copy().

im :

image to fill

x :

position to start fill

y :

position to start fill

ink :

colour to fill with

dout :

output the bounding box of the filled area

Returns :

0 on success, or -1 on error.

im_flood_blob ()

int                 im_flood_blob                       (IMAGE *im,
                                                         int x,
                                                         int y,
                                                         PEL *ink,
                                                         Rect *dout);

Flood-fill im with ink, starting at position x, y. The filled area is bounded by pixels that are equal to the start pixel, in other words, it searches for a blob of same-coloured pixels.

The bounding box of the modified pixels is returned in dout.

This an inplace operation, so im 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_flood(), im_flood_other(), im_flood_blob_copy().

im :

image to fill

x :

position to start fill

y :

position to start fill

ink :

colour to fill with

dout :

output the bounding box of the filled area

Returns :

0 on success, or -1 on error.

im_flood_other ()

int                 im_flood_other                      (IMAGE *test,
                                                         IMAGE *mark,
                                                         int x,
                                                         int y,
                                                         int serial,
                                                         Rect *dout);

Flood-fill mark with serial, starting at position x, y. The filled area is bounded by pixels in test that are equal to the start pixel, in other words, it searches test for a blob of same-coloured pixels, marking those pixels in mark with serial.

The bounding box of the modified pixels is returned in dout.

This an inplace operation, so mark 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_flood(), im_label_regions(), im_flood_blob_copy().

test :

image to test

mark :

image to mark

x :

position to start fill

y :

position to start fill

serial :

mark pixels with this number

dout :

output the bounding box of the filled area

Returns :

0 on success, or -1 on error.

im_flood_copy ()

int                 im_flood_copy                       (IMAGE *in,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         PEL *ink);

im_flood_blob_copy ()

int                 im_flood_blob_copy                  (IMAGE *in,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         PEL *ink);

im_flood_other_copy ()

int                 im_flood_other_copy                 (IMAGE *test,
                                                         IMAGE *mark,
                                                         IMAGE *out,
                                                         int x,
                                                         int y,
                                                         int serial);

im_lineset ()

int                 im_lineset                          (IMAGE *in,
                                                         IMAGE *out,
                                                         IMAGE *mask,
                                                         IMAGE *ink,
                                                         int n,
                                                         int *x1v,
                                                         int *y1v,
                                                         int *x2v,
                                                         int *y2v);