There are two principal constructors for VImage
:
VImage::VImage( const char *name, const char *mode = "r" ); VImage::VImage();
The first form creates a new VImage
, linking it to the named file.
mode
sets the mode for the file: it can take the following values:
VImage
is created which, when written to, will write pixels to disc
in the specified file.
"w"
mode, but pixels written to the VImage
will be saved
in a temporary memory buffer.
"r"
mode, but the image is mapped into your address space
read-write. This mode is only provided for the use of paintbox-style
applications, which need to directly modify an image. See §4.8.
The second form of constructor is shorthand for:
VImage( "VImage:1", "p" )
It is used for representing intermediate results of computations.
Two further constructors are handy for wrapping VImage
around existing
images.
VImage( void *buffer, int width, int height, int bands, TBandFmt format ); VImage( void *image );
The first constructor makes a VImage
from an area of memory (perhaps
from another image processing system), and the second makes a VImage
from an IMAGE
. See below for an explanation of TBandFmt
.
In both these two cases, the VIPS C++ API does not assume responsibility for the resouces: it's up to you to make sure the buffer is freed.