<!-- manual page source format generated by PolyglotMan v3.2, --> <!-- available at http://polyglotman.sourceforge.net/ --> <html> <head> <title>ADDITION(3) manual page</title> </head> <body bgcolor='white'> <a href='#toc'>Table of Contents</a><p> <h2><a name='sect0' href='#toc0'>Name</a></h2> im_add, im_gadd, im_gaddim, im_gfadd - add two images <h2><a name='sect1' href='#toc1'>Synopsis</a></h2> #include <vips/vips.h> <p> int im_add(in1, in2, out) <br> IMAGE *in1, *in2, *out; <p> int im_gadd(a, in1, b, in2, c, out) <br> double a, b, c; <br> IMAGE *in1, *in2, *out; <p> int im_gaddim(a, in1, b, in2, c, out) <br> double a, b, c; <br> IMAGE *in1, *in2, *out; <p> int im_gfadd(a, in1, b, in2, c, out) <br> double a, b, c; <br> IMAGE *in1, *in2, *out; <p> <h2><a name='sect2' href='#toc2'>Description</a></h2> These functions operate on two images held by image descriptors in1 and in2 and write the result to the image descriptor out. Input images in1 and in2 should have the same channels and the same size; however they can be of different types. Only the history of the image descriptor pointed by in1 is copied to out. <p> <a href='im_add.3.html'><b>im_add(3)</a> </b> <p> For two integer images, add the two images and write the output as <p> in1 - uchar char ushort short uint int <br> -------|-----------------------------------------<br> in2 |<br> uchar | ushort short ushort short uint int<br> char | short short short short int int<br> ushort | ushort short ushort short uint int<br> short | short short short short int int<br> uint | uint int uint int uint int<br> int | int int int int int int<br> <p> If one or more of the images is a floating point type, the output is FMTFLOAT, unless one or more of the inputs is FMTDOUBLE, in which case the output is also FMTDOUBLE. <p> If one or more of the images is a complex type, the output is FMTCOMPLEX, unless one or more of the inputs is FMTDPCOMPLEX, in which case the output is also FMTDPCOMPLEX. <p> <a href='im_gadd.3.html'><b>im_gadd(3)</a> </b> performs generalised addition of two images by calling <a href='im_gaddim.3.html'><b>im_gaddim(3)</b></a> and <a href='im_gfadd.3.html'><b>im_gfadd(3)</a> .</b> These are very old and tired things, and should not be used. <p> Input should be non complex. Output depends on input according to function called. The result at each point is: a * pel1 + b * pel2 + c, properly rounded if necessary. Pel1 and pel2 are the corresponding pixels from in1 and in2 respectively. <p> im_gaddim() performs generalised addition of in1 and in2, on the condition they are neither float nor double nor complex. The format of the resultant image is given by the table: <p> in1 - uchar char ushort short uint int <br> -------|-----------------------------------------<br> in2 |<br> uchar | ushort short ushort short uint int<br> char | short short short short int int<br> ushort | ushort short ushort short uint int<br> short | short short short short int int<br> uint | uint int uint int uint int<br> int | int int int int int int<br> <p> The result at each point is: a * pel1 + b * pel2 + c, properly rounded. Pel1 and pel2 are the corresponding pixels from in1 and in2 respectively. <p> <a href='im_gfadd.3.html'><b>im_gfadd(3)</a> </b> adds the non-complex images pointed by in1 and in2. Result is float except if one (or both) inputs is double. In the latter case the result is double. The result at each point is: a * pel1 + b * pel2 + c. Pel1 and pel2 are the corresponding pixels from in1 and in2 respectively. <p> <h2><a name='sect3' href='#toc3'>Bugs</a></h2> None of the functions checks the result for over/underflow. <h2><a name='sect4' href='#toc4'>Return Value</a></h2> All functions return 0 on success and -1 on error. <h2><a name='sect5' href='#toc5'>See Also</a></h2> <a href='im_subtract.3.html'>im_subtract(3)</a> , <a href='im_lintra.3.html'>im_lintra(3)</a> , <a href='im_multiply.3.html'>im_multiply(3)</a> . <h2><a name='sect6' href='#toc6'>Author</a></h2> N. Dessipris - 22/04/1991 <br> J. Cupitt, im_add(), - 21/7/93 <p> <hr><p> <a name='toc'><b>Table of Contents</b></a><p> <ul> <li><a name='toc0' href='#sect0'>Name</a></li> <li><a name='toc1' href='#sect1'>Synopsis</a></li> <li><a name='toc2' href='#sect2'>Description</a></li> <li><a name='toc3' href='#sect3'>Bugs</a></li> <li><a name='toc4' href='#sect4'>Return Value</a></li> <li><a name='toc5' href='#sect5'>See Also</a></li> <li><a name='toc6' href='#sect6'>Author</a></li> </ul> </body> </html>