more doc polishing

This commit is contained in:
John Cupitt 2014-11-16 12:57:27 +00:00
parent 71c5069b42
commit 008d6d7a78
3 changed files with 28 additions and 27 deletions

View File

@ -2,6 +2,7 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]> ]>
<!-- vim: set ts=2 sw=2 expandtab: -->
<refentry id="using-from-c"> <refentry id="using-from-c">
<refmeta> <refmeta>
<refentrytitle>VIPS from C</refentrytitle> <refentrytitle>VIPS from C</refentrytitle>
@ -15,7 +16,7 @@
</refnamediv> </refnamediv>
<refsect1 id="using-C"> <refsect1 id="using-C">
<title>Using VIPS from C</title> <title>Introduction</title>
<para> <para>
VIPS comes with a convenient, high-level C API. You should read the API VIPS comes with a convenient, high-level C API. You should read the API
docs for full details, but this section will try to give a brief docs for full details, but this section will try to give a brief
@ -24,15 +25,15 @@
</para> </para>
<para> <para>
When your program starts, use <function>VIPS_INIT()</function> to set up When your program starts, use <code>VIPS_INIT()</code>
the VIPS library. You should pass it the name of your program, usually to start up the VIPS library. You should pass it the name
<literal>argv[0]</literal>. Use <function>vips_shutdown()</function> of your program, usually <code>argv[0]</code>. Use
when you exit. <code>vips_shutdown()</code> when you exit.
</para> </para>
<para> <para>
You can add the VIPS flags to your %GObject command-line processing You can add the VIPS flags to your %GObject command-line processing
with <function>vips_get_option_group()</function>, see below. with <code>vips_get_option_group()</code>, see below.
</para> </para>
<para> <para>

View File

@ -2,6 +2,7 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]> ]>
<!-- vim: set ts=2 sw=2 expandtab: -->
<refentry id="using-from-cpp"> <refentry id="using-from-cpp">
<refmeta> <refmeta>
<refentrytitle>VIPS from C++</refentrytitle> <refentrytitle>VIPS from C++</refentrytitle>
@ -15,16 +16,14 @@
</refnamediv> </refnamediv>
<refsect1 id="using-cpp"> <refsect1 id="using-cpp">
<title>Using VIPS from C++</title> <title>Introduction</title>
<para> <para>
VIPS comes with a convenient C++ API. It is a very thin wrapper over the VIPS comes with a convenient C++ API. It is a very thin wrapper over the
C API and provides automatic reference counting, exceptions, operator C API and adds automatic reference counting, exceptions, operator
overloads, and automatic constant expansion. You can drop down to the C overloads, and automatic constant expansion. You can drop down to the C
API at any point, so all the C API docs also work for C++. API at any point, so all the C API docs also work for C++.
</para> </para>
<example>
<title>VIPS from C++ example</title>
<programlisting language="C++"> <programlisting language="C++">
/* compile with: /* compile with:
* g++ -g -Wall try.cc `pkg-config vips-cc --cflags --libs` * g++ -g -Wall try.cc `pkg-config vips-cc --cflags --libs`
@ -84,11 +83,11 @@ main( int argc, char **argv )
return( 0 ); return( 0 );
} }
</programlisting> </programlisting>
</example>
<para> <para>
Everything before <code>VImage in = VImage::..</code> is exactly as the C Everything before <code>VImage in = VImage::..</code> is exactly as the C
API. API. This boilerplate gives the example a set of standard command-line
flags.
</para> </para>
<para> <para>
@ -172,13 +171,13 @@ main( int argc, char **argv )
vips_add(): vips_add():
<programlisting language="C++"> <programlisting language="C++">
int vips_add( VipsImage *left, VipsImage *right, VipsImage **out, ... ); int vips_add( VipsImage *left, VipsImage *right, VipsImage **out, ... );
</programlisting> </programlisting>
appears in C++ as: appears in C++ as:
<programlisting language="C++"> <programlisting language="C++">
VImage VImage::add( VImage right, VOption *options = 0 ); VImage VImage::add( VImage right, VOption *options = 0 );
</programlisting> </programlisting>
</para> </para>
@ -193,7 +192,7 @@ main( int argc, char **argv )
Next we reload the image. The VImage::avg() will have scanned the image Next we reload the image. The VImage::avg() will have scanned the image
and reached the end of the file, we need to scan again for the next and reached the end of the file, we need to scan again for the next
operation. If we'd selected random access mode (the default) in the operation. If we'd selected random access mode (the default) in the
original VImage::new_from_file(), we would not need to load again. original VImage::new_from_file(), we would not need to reload.
</para> </para>
<para> <para>
@ -227,14 +226,14 @@ main( int argc, char **argv )
bandwise join of two RGB images would be a six-band image) with: bandwise join of two RGB images would be a six-band image) with:
<programlisting language="C++"> <programlisting language="C++">
VImage rgb = ...; VImage rgb = ...;
VImage six_band = rgb.bandjoin( rgb ); VImage six_band = rgb.bandjoin( rgb );
</programlisting> </programlisting>
You can also bandjoin a constant, for example: You can also bandjoin a constant, for example:
<programlisting language="C++"> <programlisting language="C++">
VImage rgb_with_alpha = rgb.bandjoin( 255 ); VImage rgb_with_alpha = rgb.bandjoin( 255 );
</programlisting> </programlisting>
Will add an extra band to an image, with every element in the new band Will add an extra band to an image, with every element in the new band
@ -243,7 +242,7 @@ main( int argc, char **argv )
converted. For example: converted. For example:
<programlisting language="C++"> <programlisting language="C++">
VImage a = (a &lt; 128).ifthenelse( 128, a ); VImage a = (a &lt; 128).ifthenelse( 128, a );
</programlisting> </programlisting>
Will set every band element of <code>a</code> less than 128 to 128. Will set every band element of <code>a</code> less than 128 to 128.
@ -264,20 +263,20 @@ main( int argc, char **argv )
named after the enum. For example, the C function: named after the enum. For example, the C function:
<programlisting language="C++"> <programlisting language="C++">
int vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... ); int vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... );
</programlisting> </programlisting>
where #VipsOperationMath has the member #VIPS_OPERATION_MATH_SIN, has a where #VipsOperationMath has the member #VIPS_OPERATION_MATH_SIN, has a
C convenience function vips_sin(): C convenience function vips_sin():
<programlisting language="C++"> <programlisting language="C++">
int vips_sin( VipsImage *in, VipsImage **out, ... ); int vips_sin( VipsImage *in, VipsImage **out, ... );
</programlisting> </programlisting>
and a C++ member function VImage::sin(): and a C++ member function VImage::sin():
<programlisting language="C++"> <programlisting language="C++">
VImage VImage::sin( VOption *options = 0 ); VImage VImage::sin( VOption *options = 0 );
</programlisting> </programlisting>
</para> </para>
@ -287,10 +286,10 @@ main( int argc, char **argv )
<title>Extending the C++ interface</title> <title>Extending the C++ interface</title>
<para> <para>
The C++ interface comes in two parts. First, VImage8.h defines a simple The C++ interface comes in two parts. First, <code>VImage8.h</code>
layer over #GObject for automatic reference counting, then a generic way defines a simple layer over #GObject for automatic reference counting,
to call any vips8 operation with VImage::call(), then a few convenience then a generic way to call any vips8 operation with VImage::call(),
functions, then a set of overloads. then a few convenience functions, then a set of overloads.
</para> </para>
<para> <para>

View File

@ -94,7 +94,8 @@ im = im.similarity(scale = 0.9, interpolate = Vips.Interpolate.new("bicubic"))
<para> <para>
Finally, <code>.write_to_file()</code> sends the image back to the Finally, <code>.write_to_file()</code> sends the image back to the
filesystem. There's also <code>.write_to_buffer()</code> to make a filesystem. There's also <code>.write_to_buffer()</code> to make a
string containing the formatted image. string containing the formatted image, and <code>.write()</code> to
write to another image.
</para> </para>
</refsect1> </refsect1>