From 4e96db4216921db9b7cb68c165c3aa484eae0ca7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 27 Apr 2015 17:40:33 +0100 Subject: [PATCH] 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 --- doc/using-cpp.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/using-cpp.xml b/doc/using-cpp.xml index d0ffe232..a83c277b 100644 --- a/doc/using-cpp.xml +++ b/doc/using-cpp.xml @@ -24,7 +24,7 @@ API at any point, so all the C API docs also work for C++. - + /* compile with: * 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 vips_add(): - + int vips_add( VipsImage *left, VipsImage *right, VipsImage **out, ... ); appears in C++ as: - + VImage VImage::add( VImage right, VOption *options = 0 ); @@ -229,14 +229,14 @@ VImage VImage::add( VImage right, VOption *options = 0 ); For example, you can join two images together bandwise (the bandwise join of two RGB images would be a six-band image) with: - + VImage rgb = ...; VImage six_band = rgb.bandjoin( rgb ); You can also bandjoin a constant, for example: - + VImage rgb_with_alpha = rgb.bandjoin( 255 ); @@ -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 converted. For example: - + VImage a = (a < 128).ifthenelse( 128, a ); @@ -261,7 +261,7 @@ VImage a = (a < 128).ifthenelse( 128, a ); The API overloads [] to be vips_extract_band(). You can write: - + 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; @@ -273,7 +273,7 @@ VImage mask = (xyz[0].pow( 2 ) + xyz[1].pow( 2 )).pow( 0.5 ) < 100; The API overloads () to be vips_getpoint(). You can write: - + VImage xyz = VImage::xyz( 256, 256 ) - VImage::to_vectorv( 2, 128.0, 128.0 ); // this will have the value [0, 0] 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 named after the enum. For example, the C function: - + int vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... ); where #VipsOperationMath has the member #VIPS_OPERATION_MATH_SIN, has a C convenience function vips_sin(): - + int vips_sin( VipsImage *in, VipsImage **out, ... ); and a C++ member function VImage::sin(): - + VImage VImage::sin( VOption *options = 0 ); @@ -332,7 +332,7 @@ VImage VImage::sin( VOption *options = 0 ); You can write the wrapper yourself, of course, they are very simple. The one for VImage::add() looks like this: - + VImage VImage::add(VImage right, VOption *options) throw VError {