next up previous contents
Next: 3.5 Computing with VImages Up: 3. The VImage class Previous: 3.3 Projection functions   Contents

3.4 Assignment

VImage defines copy and assignment, with reference-counted pointer-style semantics. For example, if you write:

VImage fred( "fred.v" );
VImage jim( "jim.v" );

fred = jim;

This will automatically close the file fred.v, and make the variable fred point to the image jim.v instead. Both jim and fred now point to the same underlying image object.

Internally, a VImage object is just a pointer to a reference-counting block, which in turn holds a pointer to the underlying VIPS IMAGE type. You can therefore efficiently pass VImage objects to functions by value, and return VImage objects as function results.



John Cupitt 2005-04-11