Method

VipsImageaffine

Declaration [src]

int
vips_affine (
  VipsImage* in,
  VipsImage** out,
  double a,
  double b,
  double c,
  double d,
  ...
)

Description [src]

Optional arguments:

  • interpolate: VipsInterpolate, interpolate pixels with this
  • oarea: VipsArrayInt, output rectangle
  • idx: %gdouble, input horizontal offset
  • idy: %gdouble, input vertical offset
  • odx: %gdouble, output horizontal offset
  • ody: %gdouble, output vertical offset
  • extend: VipsExtend how to generate new pixels
  • background: VipsArrayDouble colour for new pixels
  • premultiplied: %gboolean, images are already premultiplied

This operator performs an affine transform on an image using interpolate.

The transform is:

  X = @a * (x + @idx) + @b * (y + @idy) + @odx
  Y = @c * (x + @idx) + @d * (y + @idy) + @doy

  where:
    x and y are the coordinates in input image.
    X and Y are the coordinates in output image.
    (0,0) is the upper left corner.

The section of the output space defined by oarea is written to out. oarea is a four-element int array of left, top, width, height. By default oarea is just large enough to cover the whole of the transformed input image.

By default, new pixels are filled with background. This defaults to zero (black). You can set other extend types with extend. #VIPS_EXTEND_COPY is better for image upsizing.

interpolate defaults to bilinear.

idx, idy, odx, ody default to zero.

Image are normally treated as unpremultiplied, so this operation can be used directly on PNG images. If your images have been through vips_premultiply(), set premultiplied.

This operation does not change xres or yres. The image resolution needs to be updated by the application.

See also: vips_shrink(), vips_resize(), VipsInterpolate.

This method is not directly available to language bindings.

Parameters

out

Type: VipsImage

Output image.

The argument will be set by the function.
The caller of the method takes ownership of the returned data, and is responsible for freeing it.
a

Type: double

Transformation matrix coefficient.

b

Type: double

Transformation matrix coefficient.

c

Type: double

Transformation matrix coefficient.

d

Type: double

Transformation matrix coefficient.

...

Type: 

NULL-terminated list of optional named arguments.

Return value

Type: int

0 on success, -1 on error.