vector to ink is all new-style

final bit of vips7 api use removed from vips8 ops
This commit is contained in:
John Cupitt 2011-11-01 09:43:15 +00:00
parent c673bd139b
commit 5a73f0dede
7 changed files with 27 additions and 22 deletions

View File

@ -163,7 +163,7 @@
* Operations on integer images are performed using the processor's vector unit,
* if possible. Disable this with --vips-novector or IM_NOVECTOR.
*
* See also: im_subtract(), im_lintra().
* See also: #VipsSubtract, #VipsLinear.
*/
typedef VipsBinary VipsAdd;

View File

@ -155,7 +155,7 @@
* In other words, the output type is just large enough to hold the whole
* range of possible values.
*
* See also: im_add(), im_lintra().
* See also: #VipsAdd, #VipsLinear.
*
* Returns: 0 on success, -1 on error
*/

View File

@ -438,7 +438,7 @@ vips_cast_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_cast_parent_class )->build( object ) )
return( -1 );
/* Trivial case: fall back to im_copy().
/* Trivial case: fall back to copy().
*/
if( cast->in->BandFmt == cast->format )
return( vips_image_write( cast->in, conversion->out ) );

View File

@ -1,4 +1,4 @@
/* im_embed
/* VipsEmbed
*
* Author: J. Cupitt
* Written on: 21/2/95

View File

@ -157,7 +157,7 @@ vips_extract_area_build( VipsObject *object )
extract->top + extract->height > extract->in->Ysize ||
extract->left < 0 || extract->top < 0 ||
extract->width <= 0 || extract->height <= 0 ) {
im_error( "VipsExtractArea", "%s", _( "bad extract area" ) );
vips_error( "VipsExtractArea", "%s", _( "bad extract area" ) );
return( -1 );
}
@ -332,7 +332,7 @@ vips_extract_band_build( VipsObject *object )
return( -1 );
if( extract->band + extract->n > extract->in->Bands ) {
im_error( "VipsExtractBand", "%s", _( "bad extract band" ) );
vips_error( "VipsExtractBand", "%s", _( "bad extract band" ) );
return( -1 );
}

View File

@ -57,8 +57,8 @@
*/
/*
#define VIPS_DEBUG
*/
#define VIPS_DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -105,7 +105,7 @@
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>).
*
* See also: im_insert_noexpand(), im_lrjoin().
* See also: #VipsJoin.
*
* Returns: 0 on success, -1 on error
*/
@ -247,30 +247,35 @@ vips_insert_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
PEL *
vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
{
VipsImage *t[3];
double *zeros;
VipsImage **t;
double *ones;
int i;
if( vips_check_vector( domain, n, im ) )
return( NULL );
if( im_open_local_array( im, t, 3, "vtoi", "t" ) ||
!(zeros = VIPS_ARRAY( im, n, double )) )
return( NULL );
for( i = 0; i < n; i++ )
zeros[i] = 0.0;
if( im_black( t[0], 1, 1, im->Bands ) ||
im_lintra_vec( n, zeros, t[0], vec, t[1] ) ||
im_clip2fmt( t[1], t[2], im->BandFmt ) )
t = (VipsImage **) vips_object_local_array( VIPS_OBJECT( im ), 4 );
ones = VIPS_ARRAY( im, n, double );
for( i = 0; i < n; i++ )
ones[i] = 1.0;
if( vips_black( &t[0], 1, 1, "bands", im->Bands, NULL ) ||
vips_linear( t[0], &t[1], ones, vec, n, NULL ) ||
vips_cast( t[1], &t[2], im->BandFmt, NULL ) ||
!(t[3] = vips_image_new_mode( "vtoi", "t" )) ||
vips_image_write( t[2], t[3] ) )
return( NULL );
#ifdef VIPS_DEBUG
{
PEL *p = t[3]->data;
printf( "vips__vector_to_ink: ink = %p (%d %d %d)\n",
t[2]->data,
t[2]->data[0], t[2]->data[1], t[2]->data[2] );
p, p[0], p[1], p[2] );
}
#endif /*VIPS_DEBUG*/
return( (PEL *) t[2]->data );
return( (PEL *) t[3]->data );
}
static int

View File

@ -148,7 +148,7 @@ vips_replicate_gen( VipsRegion *or, void *seq, void *a, void *b,
paint.left -= x;
paint.top -= y;
g_assert( !im_rect_isempty( &paint ) );
g_assert( !vips_rect_isempty( &paint ) );
/* Render into or.
*/