add some API for args, fix a docs messup

This commit is contained in:
John Cupitt 2015-03-02 22:02:33 +00:00
parent 094f690042
commit 339f268200
11 changed files with 59 additions and 18 deletions

View File

@ -12,6 +12,7 @@
- jpg, magick, png, tiff readers now use only 1 fd per input image
- python: use [] to index and slice image bands
- c++: use [] to band index, () returns a vector<double>
- added vips_info_set(), vips_progress_set(), vips_profile_set()
6/2/15 started 7.42.3
- bump version for back-compat ABI change

10
TODO
View File

@ -1,3 +1,5 @@
- does cplusplus need flipver() etc.?
- are the mosaic functions calling vips_fastcor()? it must be very slow
add vips_fastcor_direct()
@ -21,14 +23,6 @@
- need API for the stuff that's currently settable only by --whatever flags,
eg. --vips-profile
python people are not going to want to use the glib arg parser, for example
- support orientation tag in tiff images
see

View File

@ -270,13 +270,13 @@ VImage mask = (xyz[0].pow( 2 ) + xyz[1].pow( 2 )).pow( 0.5 ) &lt; 100;
</para>
<para>
The API overloads <code>()<code> to be vips_getpoint(). You can
The API overloads <code>()</code> to be vips_getpoint(). You can
write:
<programlisting language="C++">
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);
std::vector&lt;double&gt; point = xyz(128, 128);
</programlisting>
</para>

View File

@ -53,6 +53,7 @@ void vips_g_error( GError **error );
void vips_warn( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vwarn( const char *domain, const char *fmt, va_list ap );
void vips_info_set( gboolean info );
void vips_info( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vinfo( const char *domain, const char *fmt, va_list ap );

View File

@ -63,6 +63,8 @@ G_STMT_START { \
extern gboolean vips__thread_profile;
void vips_profile_set( gboolean profile );
void vips__thread_profile_attach( const char *thread_name );
void vips__thread_profile_detach( void );
void vips__thread_profile_stop( void );

View File

@ -408,6 +408,8 @@ extern const guint64 vips__image_sizeof_bandformat[];
((double *) VIPS_IMAGE_ADDR( I, X, Y ))
#endif /*VIPS_DEBUG*/
void vips_progress_set( gboolean progress );
void vips_image_invalidate_all( VipsImage *image );
void vips_image_minimise_all( VipsImage *image );

View File

@ -371,6 +371,20 @@ vips_error_clear( void )
g_mutex_unlock( vips__global_lock );
}
/**
* vips_info_set:
* @info: %TRUE to enable info messages
*
* If set, vips will output various informative messages to stderr as it works.
*
* See also: vips_info().
*/
void
vips_info_set( gboolean info )
{
vips__info = info;
}
/**
* vips_vinfo:
* @domain: the source of the message
@ -378,13 +392,13 @@ vips_error_clear( void )
* @ap: arguments to the format string
*
* Sends a formatted informational message to stderr if the --vips-info flag
* has been given to the program or the environment variable IM_INFO has been
* defined.
* has been given to the program, or the environment variable VIPS_INFO has been
* defined, or if vips_info_set() has been called.
*
* Informational messages are used to report details about the operation of
* functions.
*
* See also: vips_info(), vips_warn().
* See also: vips_info(), vips_info_set(), vips_warn().
*/
void
vips_vinfo( const char *domain, const char *fmt, va_list ap )
@ -407,13 +421,13 @@ vips_vinfo( const char *domain, const char *fmt, va_list ap )
* @...: arguments to the format string
*
* Sends a formatted informational message to stderr if the --vips-info flag
* has been given to the program or the environment variable IM_INFO has been
* defined.
* has been given to the program or the environment variable VIPS_INFO has been
* defined, or if vips_info_set() has been called.
*
* Informational messages are used to report details about the operation of
* functions.
*
* See also: vips_vinfo(), vips_warn().
* See also: vips_info_set(), vips_vinfo(), vips_warn().
*/
void
vips_info( const char *domain, const char *fmt, ... )

View File

@ -84,6 +84,19 @@ static GPrivate *vips_thread_profile_key = NULL;
static FILE *vips__thread_fp = NULL;;
/**
* vips_profile_set:
* @info: %TRUE to enable profile recording
*
* If set, vips will record profiling information, and dump it on program
* exit. These profiles can be analysed with the `vipsprofile` program.
*/
void
vips_profile_set( gboolean profile )
{
vips__thread_profile = profile;
}
static void
vips_thread_gate_block_save( VipsThreadGateBlock *block, FILE *fp )
{

View File

@ -379,6 +379,20 @@ static guint vips_image_signals[SIG_LAST] = { 0 };
G_DEFINE_TYPE( VipsImage, vips_image, VIPS_TYPE_OBJECT );
/**
* vips_progress_set:
* @info: %TRUE to enable progress messages
*
* If set, vips will print messages about the progress of computation to
* stdout. This can also be enabled with the --vips-progress option, or by
* setting the environment variable VIPS_PROGRESS.
*/
void
vips_progress_set( gboolean progress )
{
vips__progress = progress;
}
static void
vips_image_delete( VipsImage *image )
{

View File

@ -313,7 +313,7 @@ vips_init( const char *argv0 )
*/
if( g_getenv( "VIPS_INFO" ) ||
g_getenv( "IM_INFO" ) )
vips__info = 1;
vips_info_set( TRUE );
/* Register base vips types.
*/

View File

@ -88,7 +88,7 @@
*/
#define MAX_THREADS (1024)
/* Default tile geometry ... can be set by init_world.
/* Default tile geometry ... can be set by vips_init().
*/
int vips__tile_width = VIPS__TILE_WIDTH;
int vips__tile_height = VIPS__TILE_HEIGHT;