try to get C++ examples highlighted
looks like gtk-doc only supports C highlighting looking at the sources ... still, get the language= tags to match what source-highlight expects
This commit is contained in:
parent
51c85b7450
commit
4e96db4216
@ -24,7 +24,7 @@
|
|||||||
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>
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
/* compile with:
|
/* compile with:
|
||||||
* g++ -g -Wall try.cc `pkg-config vips-cpp --cflags --libs`
|
* g++ -g -Wall try.cc `pkg-config vips-cpp --cflags --libs`
|
||||||
*/
|
*/
|
||||||
@ -172,13 +172,13 @@ main( int argc, char **argv )
|
|||||||
All other operations follow the same pattern, for example the C API call
|
All other operations follow the same pattern, for example the C API call
|
||||||
vips_add():
|
vips_add():
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
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="cpp">
|
||||||
VImage VImage::add( VImage right, VOption *options = 0 );
|
VImage VImage::add( VImage right, VOption *options = 0 );
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
@ -229,14 +229,14 @@ VImage VImage::add( VImage right, VOption *options = 0 );
|
|||||||
For example, you can join two images together bandwise (the
|
For example, you can join two images together bandwise (the
|
||||||
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="cpp">
|
||||||
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="cpp">
|
||||||
VImage rgb_with_alpha = rgb.bandjoin( 255 );
|
VImage rgb_with_alpha = rgb.bandjoin( 255 );
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ VImage rgb_with_alpha = rgb.bandjoin( 255 );
|
|||||||
constant in most places where you can use an image and it will be
|
constant in most places where you can use an image and it will be
|
||||||
converted. For example:
|
converted. For example:
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
VImage a = (a < 128).ifthenelse( 128, a );
|
VImage a = (a < 128).ifthenelse( 128, a );
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ VImage a = (a < 128).ifthenelse( 128, a );
|
|||||||
The API overloads <code>[]</code> to be vips_extract_band(). You can
|
The API overloads <code>[]</code> to be vips_extract_band(). You can
|
||||||
write:
|
write:
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
VImage xyz = VImage::xyz( 256, 256 ) - VImage::to_vectorv( 2, 128.0, 128.0 );
|
VImage xyz = VImage::xyz( 256, 256 ) - VImage::to_vectorv( 2, 128.0, 128.0 );
|
||||||
VImage mask = (xyz[0].pow( 2 ) + xyz[1].pow( 2 )).pow( 0.5 ) < 100;
|
VImage mask = (xyz[0].pow( 2 ) + xyz[1].pow( 2 )).pow( 0.5 ) < 100;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@ -273,7 +273,7 @@ VImage mask = (xyz[0].pow( 2 ) + xyz[1].pow( 2 )).pow( 0.5 ) < 100;
|
|||||||
The API overloads <code>()</code> to be vips_getpoint(). You can
|
The API overloads <code>()</code> to be vips_getpoint(). You can
|
||||||
write:
|
write:
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
VImage xyz = VImage::xyz( 256, 256 ) - VImage::to_vectorv( 2, 128.0, 128.0 );
|
VImage xyz = VImage::xyz( 256, 256 ) - VImage::to_vectorv( 2, 128.0, 128.0 );
|
||||||
// this will have the value [0, 0]
|
// this will have the value [0, 0]
|
||||||
std::vector<double> point = xyz(128, 128);
|
std::vector<double> point = xyz(128, 128);
|
||||||
@ -290,20 +290,20 @@ std::vector<double> point = xyz(128, 128);
|
|||||||
enum, such as vips_math(), are expanded to a set of member functions
|
enum, such as vips_math(), are expanded to a set of member functions
|
||||||
named after the enum. For example, the C function:
|
named after the enum. For example, the C function:
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
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="cpp">
|
||||||
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="cpp">
|
||||||
VImage VImage::sin( VOption *options = 0 );
|
VImage VImage::sin( VOption *options = 0 );
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ VImage VImage::sin( VOption *options = 0 );
|
|||||||
You can write the wrapper yourself, of course, they are very simple.
|
You can write the wrapper yourself, of course, they are very simple.
|
||||||
The one for VImage::add() looks like this:
|
The one for VImage::add() looks like this:
|
||||||
|
|
||||||
<programlisting language="C++">
|
<programlisting language="cpp">
|
||||||
VImage VImage::add(VImage right, VOption *options)
|
VImage VImage::add(VImage right, VOption *options)
|
||||||
throw VError
|
throw VError
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user