lvextract(3)

LIBRARY ROUTINE
lvextract - Extract a rectangular piece from an image and put it in a subimage

LIBRARY CALL
#include "vinclude.h"
int
lvextract(img1, img2, width, height, xoff, yoff, copymapflag)
struct xvimage *img1, **img2;
unsigned long width, height, xoff, yoff, copymapflag;

INPUT

img1
    the input xvimage structure

xoff
    the x offset from the upper left hand corner of the input image.

yoff
    the y offset from the upper left hand corner of the input image.

width
    the row_size of the output image

height
    the col_size of the output image

copymapflag
    copy map only if set

OUTPUT

*img2
    holds the result of the extract operation.

MODIFICATIONS

John Rasure Fri Mar 24 15:25:53 MST 1989 included createimage call, and added flag for the option of copying map data.

Mark Young - Re-wrote extract loop to use bcopy instead of for loops.

DESCRIPTION
lvextract removes a rectangular piece from an image to produce a subimage. The output image has the same characteristics as the input image except for a subset of the data and the subimage parameters are set.

The location data will always be preserved from the original image. The map data may or may not be copied to the new subimage.

struct xvimage *img1
    img1 is used as the input xvimage structure.

struct xvimage **img2
    img2 will be the resulting image. img1 is not touched. Memory for img2 will be allocated.

int xoff
    xoff specifies the X offset in the input image for the upper left corner of the subimage.

int yoff
    yoff specifies the Y offset in the input image for the upper left corner of the subimage.

int width
    width specifies the row_size of the resulting subimage.

int height
    height specifies col_size of the resulting subimage.

int copymapflag
    copymapflag if set to TRUE will copy the map data. If set to FALSE will not copy the map data.

The subimage parameters are set to reflect where the subimage was taken from the origonal image.

If the subimage specification extends beyond the image boundary, the largest possible subimage is returned. If the subimage is larger than the original image, the routine will fail.

lvextract returns a zero upon failure and a one upon success.

SEE ALSO
vextract(1), intro(3), vipl(3), verror(3), vutils(3)

RESTRICTIONS

AUTHOR
John Rasure, Mark Young

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.