![]() |
![]() |
![]() |
VIPS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <vips/vips.h> int im_draw_rect (VipsImage *image
,int left
,int top
,int width
,int height
,int fill
,PEL *ink
); int im_draw_circle (VipsImage *image
,int x
,int y
,int radius
,gboolean fill
,PEL *ink
); int im_draw_image (VipsImage *image
,VipsImage *sub
,int x
,int y
); int (*VipsPlotFn) (VipsImage *image
,int x
,int y
,void *a
,void *b
,void *c
); int im_draw_line_user (VipsImage *image
,int x1
,int y1
,int x2
,int y2
,VipsPlotFn plot
,void *a
,void *b
,void *c
); int im_draw_line (VipsImage *image
,int x1
,int y1
,int x2
,int y2
,PEL *ink
); int im_lineset (VipsImage *in
,VipsImage *out
,VipsImage *mask
,VipsImage *ink
,int n
,int *x1v
,int *y1v
,int *x2v
,int *y2v
); int im_draw_flood (VipsImage *image
,int x
,int y
,PEL *ink
,VipsRect *dout
); int im_draw_flood_blob (VipsImage *image
,int x
,int y
,PEL *ink
,VipsRect *dout
); int im_draw_flood_other (VipsImage *image
,VipsImage *test
,int x
,int y
,int serial
,VipsRect *dout
); int im_draw_mask (VipsImage *image
,VipsImage *mask_im
,int x
,int y
,PEL *ink
); int im_draw_point (VipsImage *image
,int x
,int y
,PEL *ink
); int im_read_point (VipsImage *image
,int x
,int y
,PEL *ink
); int im_draw_smudge (VipsImage *image
,int left
,int top
,int width
,int height
);
These operations directly modify the image. They do not thread, on 32-bit machines they will be limited to 2GB images, and a little care needs to be taken if you use them as part of an image pipeline.
They are mostly supposed to be useful for paintbox-style programs.
int im_draw_rect (VipsImage *image
,int left
,int top
,int width
,int height
,int fill
,PEL *ink
);
Paint pixels within left
, top
, width
, height
in image
with ink
. If
fill
is zero, just paint a 1-pixel-wide outline.
See also: im_draw_circle()
.
|
image to draw on |
|
area to paint |
|
area to paint |
|
area to paint |
|
area to paint |
|
fill the rect |
|
paint with this colour |
Returns : |
0 on success, or -1 on error. |
int im_draw_circle (VipsImage *image
,int x
,int y
,int radius
,gboolean fill
,PEL *ink
);
Draws a circle on image
. If fill
is TRUE
then the circle is filled,
otherwise a 1-pixel-wide perimeter is drawn.
ink
is an array of bytes containing a valid pixel for the image's format.
It must have at least IM_IMAGE_SIZEOF_PEL( image
) bytes.
See also: im_draw_line()
.
|
image to draw on |
|
centre of circle |
|
centre of circle |
|
circle radius |
|
fill the circle |
|
value to draw |
Returns : |
0 on success, or -1 on error. |
int im_draw_image (VipsImage *image
,VipsImage *sub
,int x
,int y
);
Draw sub
on top of image
at position x
, y
. The two images must have the
same
Coding. If sub
has 1 band, the bands will be duplicated to match the
number of bands in image
. sub
will be converted to image
's format, see
im_clip2fmt()
.
See also: im_insert()
.
|
image to draw on |
|
image to draw |
|
position to insert |
|
position to insert |
Returns : |
0 on success, or -1 on error. |
int (*VipsPlotFn) (VipsImage *image
,int x
,int y
,void *a
,void *b
,void *c
);
A plot function, as used by im_draw_line_user()
to draw on an image.
|
image to draw on |
|
position to draw at |
|
position to draw at |
|
user data |
|
user data |
|
user data |
int im_draw_line_user (VipsImage *image
,int x1
,int y1
,int x2
,int y2
,VipsPlotFn plot
,void *a
,void *b
,void *c
);
Calls plot
for every point on the line connecting x1
, y1
and x2
, y2
.
If you pass im_draw_mask()
as the plot operation, you can draw wide lines
or lines with various brushes.
See also: im_draw_mask()
, im_draw_line()
, im_draw_circle()
.
|
image to draw on |
|
start point |
|
start point |
|
end point |
|
end point |
|
draw operation |
|
draw operation parameter |
|
draw operation parameter |
|
draw operation parameter |
Returns : |
0 on success, or -1 on error. |
int im_draw_line (VipsImage *image
,int x1
,int y1
,int x2
,int y2
,PEL *ink
);
Draws a 1-pixel-wide line on an image.
ink
is an array of bytes
containing a valid pixel for the image's format.
It must have at least IM_IMAGE_SIZEOF_PEL( image
) bytes.
See also: im_draw_circle()
.
|
image to draw on |
|
start point |
|
start point |
|
end point |
|
end point |
|
value to draw |
Returns : |
0 on success, or -1 on error. |
int im_lineset (VipsImage *in
,VipsImage *out
,VipsImage *mask
,VipsImage *ink
,int n
,int *x1v
,int *y1v
,int *x2v
,int *y2v
);
int im_draw_flood (VipsImage *image
,int x
,int y
,PEL *ink
,VipsRect *dout
);
Flood-fill image
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
. dout
may be
NULL.
See also: im_draw_flood_blob()
, im_draw_flood_other()
.
|
image to fill |
|
position to start fill |
|
position to start fill |
|
colour to fill with |
|
output the bounding box of the filled area |
Returns : |
0 on success, or -1 on error. |
int im_draw_flood_blob (VipsImage *image
,int x
,int y
,PEL *ink
,VipsRect *dout
);
Flood-fill image
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
. dout
may be
NULL.
See also: im_draw_flood()
, im_draw_flood_other()
, im_draw_flood_blob()
.
|
image to fill |
|
position to start fill |
|
position to start fill |
|
colour to fill with |
|
output the bounding box of the filled area |
Returns : |
0 on success, or -1 on error. |
int im_draw_flood_other (VipsImage *image
,VipsImage *test
,int x
,int y
,int serial
,VipsRect *dout
);
Flood-fill image
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 image
with serial
.
The bounding box of the modified pixels is returned in dout
. dout
may be
NULL.
See also: im_draw_flood()
, im_label_regions()
, im_draw_flood_blob()
.
|
image to mark |
|
image to test |
|
position to start fill |
|
position to start fill |
|
mark pixels with this number |
|
output the bounding box of the filled area |
Returns : |
0 on success, or -1 on error. |
int im_draw_mask (VipsImage *image
,VipsImage *mask_im
,int x
,int y
,PEL *ink
);
Draw a mask on the image. mask_im
is a monochrome 8-bit image with 0/255
for transparent or ink
coloured points. Intermediate values blend the ink
with the pixel. Use with im_text()
to draw text on an image.
ink
is an array of bytes
containing a valid pixel for the image's format.
It must have at least IM_IMAGE_SIZEOF_PEL( image
) bytes.
See also: im_draw_circle()
, im_text()
, im_draw_line_user()
.
|
image to draw on |
|
draw mask here |
|
draw mask here |
|
value to draw |
|
mask of 0/255 values showing where to plot |
Returns : |
0 on success, or -1 on error. |
int im_draw_point (VipsImage *image
,int x
,int y
,PEL *ink
);
Draws a single point on an image.
ink
is an array of bytes containing a valid pixel for the image's format.
It must have at least IM_IMAGE_SIZEOF_PEL( im
) bytes.
See also: im_draw_line()
.
|
image to draw on |
|
position to draw |
|
position to draw |
|
value to draw |
Returns : |
0 on success, or -1 on error. |
int im_read_point (VipsImage *image
,int x
,int y
,PEL *ink
);
Reads a single point on an image.
ink
is an array of bytes to contain a valid pixel for the image's format.
It must have at least IM_IMAGE_SIZEOF_PEL( im
) bytes.
See also: im_draw_point()
.
|
image to read from |
|
position to read |
|
position to read |
|
read value here |
Returns : |
0 on success, or -1 on error. |
int im_draw_smudge (VipsImage *image
,int left
,int top
,int width
,int height
);
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()
.
|
image to smudge |
|
area to smudge |
|
area to smudge |
|
area to smudge |
|
area to smudge |
Returns : |
0 on success, or -1 on error. |