Movatterモバイル変換


[0]ホーム

URL:


libvips

A fast image processing library with low memory needs.

DownloadInstallDocumentationIssuesWikilibvips projectslibvips on GitHub
Top  | Description  | Object HierarchyHomeUpPrevNext

draw

draw — drawing operations: flood, paste, line, circle

Stability Level

Stable, unless otherwise indicated

Functions

intvips_draw_rect ()
intvips_draw_rect1 ()
intvips_draw_point ()
intvips_draw_point1 ()
intvips_draw_image ()
intvips_draw_mask ()
intvips_draw_mask1 ()
intvips_draw_line ()
intvips_draw_line1 ()
intvips_draw_circle ()
intvips_draw_circle1 ()
intvips_draw_flood ()
intvips_draw_flood1 ()
intvips_draw_smudge ()

Types and Values

enumVipsCombineMode

Object Hierarchy

GEnum╰── VipsCombineMode

Includes

#include <vips/vips.h>

Description

These operations directly modify the image. They do not thread, on 32-bitmachines they will be limited to 2GB images, and a little care needs to betaken if you use them as part of an image pipeline.They are mostly supposed to be useful for paintbox-style programs.

libvips operations are all functional: they take zero or more existing inputimages and generate zero or more new output images. Images arenever altered, you always create new images. This means libvips can cacheand thread very aggressively.

The downside is that creating entirely fresh images each time can be veryslow. libvips has a range of tricks to avoid these problems, but there arestill times when you really have to be able to modify an image. An examplemight be drawing a curved line from a set of straight line segments: if youneed to draw 1,000 straight lines, a 1,000 operation-deep pipeline is goingto be a slow way to do it. This is where the draw operations come in.

To use these operations, usevips_image_copy_memory() to make a privatememory copy of the image you want to modify, then call aseries of draw operations.

Once you are done drawing, return to normal use of vips operations. Any timeyou want to start drawing again, you'll need to copy again.

Functions

vips_draw_rect ()

intvips_draw_rect (VipsImage *image,double *ink,int n,int left,int top,int width,int height,...);

Optional arguments:

  • fill: fill the rect

Paint pixels withinleft,top,width,height inimage withink. Iffill is zero, just paint a 1-pixel-wide outline.

See also:vips_draw_circle().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

length of ink array

 

left

area to paint

 

top

area to paint

 

width

area to paint

 

height

area to paint

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_rect1 ()

intvips_draw_rect1 (VipsImage *image,double ink,int left,int top,int width,int height,...);

Optional arguments:

  • fill: fill the rect

Asvips_draw_rect(), but just take a single double forink.

See also:vips_draw_rect().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

left

area to paint

 

top

area to paint

 

width

area to paint

 

height

area to paint

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_point ()

intvips_draw_point (VipsImage *image,double *ink,int n,int x,int y,...);

Asvips_draw_rect(), but draw a single pixel atx,y.

See also:vips_draw_rect().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

length of ink array

 

x

point to paint

 

y

point to paint

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_point1 ()

intvips_draw_point1 (VipsImage *image,double ink,int x,int y,...);

Asvips_draw_point(), but just take a single double forink.

See also:vips_draw_point().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

x

point to draw

 

y

point to draw

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_image ()

intvips_draw_image (VipsImage *image,VipsImage *sub,int x,int y,...);

Optional arguments:

  • mode: how to combine pixels

Drawsub on top ofimage at positionx,y. The two images must have thesame Coding. Ifsub has 1 band, the bands will be duplicated to match thenumber of bands inimage.sub will be converted toimage's format, seevips_cast().

Usemode to set how pixels are combined. If you useVIPS_COMBINE_MODE_ADD, both images muct be uncoded.

See also:vips_draw_mask(),vips_insert().

[method]

Parameters

image

image to draw on

 

sub

image to paint

 

x

drawsubhere

 

y

drawsubhere

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_mask ()

intvips_draw_mask (VipsImage *image,double *ink,int n,VipsImage *mask,int x,int y,...);

Drawmask on the image.mask is a monochrome 8-bit image with 0/255for transparent orink coloured points. Intermediate values blend the inkwith the pixel. Use withvips_text() to draw text on an image. Use in avips_draw_line() subclass to draw an object along a line.

ink is an array of double containing values to draw.

See also:vips_text(),vips_draw_line().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

size of ink array

 

mask

mask of 0/255 values showing where to plot

 

x

draw mask here

 

y

draw mask here

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_mask1 ()

intvips_draw_mask1 (VipsImage *image,double ink,VipsImage *mask,int x,int y,...);

Asvips_draw_mask(), but just takes a single double forink.

See also:vips_draw_mask().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

mask

mask of 0/255 values showing where to plot

 

x

draw mask here

 

y

draw mask here

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_line ()

intvips_draw_line (VipsImage *image,double *ink,int n,int x1,int y1,int x2,int y2,...);

Draws a 1-pixel-wide line on an image.

ink is an array of double containing values to draw.

See also:vips_draw_line1(),vips_draw_circle(),vips_draw_mask().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

length of ink array

 

x1

start of draw_line

 

y1

start of draw_line

 

x2

end of draw_line

 

y2

end of draw_line

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_line1 ()

intvips_draw_line1 (VipsImage *image,double ink,int x1,int y1,int x2,int y2,...);

Asvips_draw_line(), but just take a single double forink.

See also:vips_draw_line().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

x1

start of draw_line

 

y1

start of draw_line

 

x2

end of draw_line

 

y2

end of draw_line

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_circle ()

intvips_draw_circle (VipsImage *image,double *ink,int n,int cx,int cy,int radius,...);

Optional arguments:

  • fill: fill the draw_circle

Draws a circle onimage. Iffill isTRUE then the circle is filled,otherwise a 1-pixel-wide perimeter is drawn.

ink is an array of double containing values to draw.

See also:vips_draw_circle1(),vips_draw_line().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

length of ink array

 

cx

centre of draw_circle

 

cy

centre of draw_circle

 

radius

draw_circle radius

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_circle1 ()

intvips_draw_circle1 (VipsImage *image,double ink,int cx,int cy,int radius,...);

Optional arguments:

  • fill: fill the draw_circle

Asvips_draw_circle(), but just takes a single double forink.

See also:vips_draw_circle().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

cx

centre of draw_circle

 

cy

centre of draw_circle

 

radius

draw_circle radius

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_flood ()

intvips_draw_flood (VipsImage *image,double *ink,int n,int x,int y,...);

Optional arguments:

  • test: test this image

  • equal: fill while equal to edge

  • left: output left edge of bounding box of modified area

  • top: output top edge of bounding box of modified area

  • width: output width of bounding box of modified area

  • height: output height of bounding box of modified area

Flood-fillimage withink, starting at positionx,y. The filled area isbounded by pixels that are equal to the ink colour, in other words, itsearches for pixels enclosed by an edge ofink.

Ifequal is set, it instead searches for pixels which are equal to thestart point and fills them withink.

Normally it will test and set pixels inimage. Iftest is set, it willtest pixels intest and set pixels inimage. This lets you search animage (test) for continuous areas of pixels without modifying it.

left,top,width,height output the bounding box of the modifiedpixels.

ink is an array of double containing values to draw.

See also:vips_draw_flood1().

[method]

Parameters

image

image to draw on

 

ink

value to draw.

[array length=n]

n

length of ink array

 

x

centre of circle

 

y

centre of circle

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_flood1 ()

intvips_draw_flood1 (VipsImage *image,double ink,int x,int y,...);

Optional arguments:

  • test: test this image

  • equal: fill while equal to edge

  • left: output left edge of bounding box of modified area

  • top: output top edge of bounding box of modified area

  • width: output width of bounding box of modified area

  • height: output height of bounding box of modified area

Asvips_draw_flood(), but just takes a single double forink.

See also:vips_draw_flood().

[method]

Parameters

image

image to draw on

 

ink

value to draw

 

x

centre of circle

 

y

centre of circle

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_draw_smudge ()

intvips_draw_smudge (VipsImage *image,int left,int top,int width,int height,...);

Smudge a section ofimage. Each pixel in the arealeft,top,width,height is replaced by the average of the surrounding 3x3 pixels.

See also:vips_draw_line().

[method]

Parameters

image

image to draw on

 

left

point to paint

 

top

point to paint

 

width

area to paint

 

height

area to paint

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.

Types and Values

enum VipsCombineMode

Seevips_draw_image() and so on.

Operations likevips_draw_image() need to be told how to combine imagesfrom two sources.

See also:vips_join().

Members

VIPS_COMBINE_MODE_SET

set pixels to the new value

 

VIPS_COMBINE_MODE_ADD

add pixels

 

VIPS_COMBINE_MODE_LAST

  

Generated by GTK-Doc V1.34.0

[8]ページ先頭

©2009-2025 Movatter.jp