本文整理汇总了C++中VIPS_OBJECT_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ VIPS_OBJECT_CLASS函数的具体用法?C++ VIPS_OBJECT_CLASS怎么用?C++ VIPS_OBJECT_CLASS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VIPS_OBJECT_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vips_similarity_build
static int
vips_similarity_build( VipsObject *object )
{
VipsResample *resample = VIPS_RESAMPLE( object );
VipsSimilarity *similarity = (VipsSimilarity *) object;
VipsImage **t = (VipsImage **)
vips_object_local_array( object, 4 );
double a, b, c, d;
if( VIPS_OBJECT_CLASS( vips_similarity_parent_class )->build( object ) )
return( -1 );
a = similarity->scale * cos( VIPS_RAD( similarity->angle ) );
b = sin( VIPS_RAD( similarity->angle ) );
c = -b;
d = a;
if( vips_affine( resample->in, &t[0], a, b, c, d,
"interpolate", similarity->interpolate,
"odx", similarity->odx,
"ody", similarity->ody,
"idx", similarity->idx,
"idy", similarity->idy,
NULL ) ||
vips_image_write( t[0], resample->out ) )
return( -1 );
return( 0 );
}
示例2: vips_min_build
static int
vips_min_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsMin *min = (VipsMin *) object;
if( VIPS_OBJECT_CLASS( vips_min_parent_class )->build( object ) )
return( -1 );
/* Don't set if there's no value (eg. if every pixel is NaN). This
* will trigger an error later.
*/
if( min->set ) {
double m;
/* For speed we accumulate min^2 for complex.
*/
m = min->min;
if( vips_bandfmt_iscomplex(
vips_image_get_format( statistic->in ) ) )
m = sqrt( m );
/* We have to set the props via g_object_set() to stop vips
* complaining they are unset.
*/
g_object_set( min,
"out", m,
"x", min->x,
"y", min->y,
NULL );
}
return( 0 );
}
示例3: vips_bandjoin_build
static int
vips_bandjoin_build( VipsObject *object )
{
VipsBandary *bandary = (VipsBandary *) object;
VipsBandjoin *bandjoin = (VipsBandjoin *) object;
if( bandjoin->in ) {
bandary->in = vips_array_image_get( bandjoin->in, &bandary->n );
if( bandary->n == 1 )
return( vips_bandary_copy( bandary ) );
else {
int i;
bandary->out_bands = 0;
for( i = 0; i < bandary->n; i++ )
if( bandary->in[i] )
bandary->out_bands +=
bandary->in[i]->Bands;
}
}
if( VIPS_OBJECT_CLASS( vips_bandjoin_parent_class )->build( object ) )
return( -1 );
return( 0 );
}
示例4: vips_sequential_build
static int
vips_sequential_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsSequential *sequential = (VipsSequential *) object;
VipsImage *t;
VIPS_DEBUG_MSG( "vips_sequential_build\n" );
if( VIPS_OBJECT_CLASS( vips_sequential_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( sequential->in ) )
return( -1 );
if( vips_linecache( sequential->in, &t,
"tile_height", sequential->tile_height,
"access", sequential->access,
NULL ) )
return( -1 );
vips_object_local( object, t );
if( vips_image_pipelinev( conversion->out,
VIPS_DEMAND_STYLE_THINSTRIP, t, NULL ) )
return( -1 );
if( vips_image_generate( conversion->out,
vips_start_one, vips_sequential_generate, vips_stop_one,
t, sequential ) )
return( -1 );
return( 0 );
}
示例5: vips_interpolate_bicubic_class_init
static void
vips_interpolate_bicubic_class_init( VipsInterpolateBicubicClass *iclass )
{
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( iclass );
VipsInterpolateClass *interpolate_class =
VIPS_INTERPOLATE_CLASS( iclass );
object_class->nickname = "bicubic";
object_class->description = _( "Bicubic interpolation (Catmull-Rom)" );
interpolate_class->interpolate = vips_interpolate_bicubic_interpolate;
interpolate_class->window_size = 4;
/* Build the tables of pre-computed coefficients.
*/
for( int x = 0; x < VIPS_TRANSFORM_SCALE + 1; x++ ) {
calculate_coefficients_catmull(
(float) x / VIPS_TRANSFORM_SCALE,
vips_bicubic_matrixf[x] );
for( int i = 0; i < 4; i++ )
vips_bicubic_matrixi[x][i] =
vips_bicubic_matrixf[x][i] *
VIPS_INTERPOLATE_SCALE;
}
}
示例6: vips_tile_cache_build
static int
vips_tile_cache_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsTileCache *cache = (VipsTileCache *) object;
VIPS_DEBUG_MSG( "vips_tile_cache_build\n" );
if( VIPS_OBJECT_CLASS( vips_tile_cache_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( cache->in ) )
return( -1 );
if( vips_image_copy_fields( conversion->out, cache->in ) )
return( -1 );
vips_demand_hint( conversion->out,
VIPS_DEMAND_STYLE_SMALLTILE, cache->in, NULL );
if( vips_image_generate( conversion->out,
vips_start_one, vips_tile_cache_gen, vips_stop_one,
cache->in, cache ) )
return( -1 );
return( 0 );
}
示例7: vips_statistic_build
static int
vips_statistic_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
const char *domain = class->nickname;
#ifdef DEBUG
printf( "vips_statistic_build: " );
vips_object_print_name( object );
printf( "\n" );
#endif /*DEBUG*/
if( VIPS_OBJECT_CLASS( vips_statistic_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( statistic->in ) ||
vips_check_uncoded( domain, statistic->in ) )
return( -1 );
if( vips_sink( statistic->in,
vips_statistic_scan_start,
vips_statistic_scan,
vips_statistic_scan_stop,
statistic, NULL ) )
return( -1 );
return( 0 );
}
示例8: vips_worley_build
static int
vips_worley_build( VipsObject *object )
{
VipsCreate *create = VIPS_CREATE( object );
VipsWorley *worley = (VipsWorley *) object;
if( VIPS_OBJECT_CLASS( vips_worley_parent_class )->build( object ) )
return( -1 );
/* Be careful if width is a multiple of cell_size.
*/
worley->cells_across = ROUND_UP( worley->width, worley->cell_size ) /
worley->cell_size;
worley->cells_down = ROUND_UP( worley->height, worley->cell_size ) /
worley->cell_size;
worley->seed = g_random_double() * 0xffffffffu;
vips_image_init_fields( create->out,
worley->width, worley->height, 1,
VIPS_FORMAT_INT, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );
if( vips_image_generate( create->out,
vips_worley_start, vips_worley_gen, vips_worley_stop,
worley, NULL ) )
return( -1 );
return( 0 );
}
示例9: vips_min_build
static int
vips_min_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsMin *min = (VipsMin *) object;
double m;
if( VIPS_OBJECT_CLASS( vips_min_parent_class )->build( object ) )
return( -1 );
/* For speed we accumulate min^2 for complex.
*/
m = min->min;
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
m = sqrt( m );
/* We have to set the props via g_object_set() to stop vips
* complaining they are unset.
*/
g_object_set( min,
"out", m,
"x", min->x,
"y", min->y,
NULL );
return( 0 );
}
示例10: vips_region_build
static int
vips_region_build( VipsObject *object )
{
VipsRegion *region = VIPS_REGION( object );
VipsImage *image = region->im;
VIPS_DEBUG_MSG( "vips_region_build: %p\n", region );
if( VIPS_OBJECT_CLASS( vips_region_parent_class )->build( object ) )
return( -1 );
vips__region_take_ownership( region );
/* We're usually inside the ss lock anyway. But be safe ...
*/
VIPS_GATE_START( "vips_region_build: wait" );
g_mutex_lock( image->sslock );
VIPS_GATE_STOP( "vips_region_build: wait" );
image->regions = g_slist_prepend( image->regions, region );
g_mutex_unlock( image->sslock );
return( 0 );
}
示例11: vips_replicate_build
static int
vips_replicate_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsReplicate *replicate = (VipsReplicate *) object;
if( VIPS_OBJECT_CLASS( vips_replicate_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( replicate->in ) )
return( -1 );
if( vips_image_copy_fields( conversion->out, replicate->in ) )
return( -1 );
vips_demand_hint( conversion->out,
VIPS_DEMAND_STYLE_SMALLTILE, replicate->in, NULL );
conversion->out->Xsize *= replicate->across;
conversion->out->Ysize *= replicate->down;
if( vips_image_generate( conversion->out,
vips_start_one, vips_replicate_gen, vips_stop_one,
replicate->in, replicate ) )
return( -1 );
return( 0 );
}
示例12: vips_sequential_build
static int
vips_sequential_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsSequential *sequential = (VipsSequential *) object;
VIPS_DEBUG_MSG( "vips_sequential_build\n" );
if( VIPS_OBJECT_CLASS( vips_sequential_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( sequential->in ) )
return( -1 );
if( vips_image_copy_fields( conversion->out, sequential->in ) )
return( -1 );
vips_demand_hint( conversion->out,
VIPS_DEMAND_STYLE_FATSTRIP, sequential->in, NULL );
if( vips_image_generate( conversion->out,
vips_start_one, vips_sequential_generate, vips_stop_one,
sequential->in, sequential ) )
return( -1 );
return( 0 );
}
示例13: vips_merge_build
static int
vips_merge_build( VipsObject *object )
{
VipsMerge *merge = (VipsMerge *) object;
g_object_set( merge, "out", vips_image_new(), NULL );
if( VIPS_OBJECT_CLASS( vips_merge_parent_class )->build( object ) )
return( -1 );
switch( merge->direction ) {
case VIPS_DIRECTION_HORIZONTAL:
if( im_lrmerge( merge->ref, merge->sec, merge->out,
merge->dx, merge->dy, merge->mblend ) )
return( -1 );
break;
case VIPS_DIRECTION_VERTICAL:
if( im_tbmerge( merge->ref, merge->sec, merge->out,
merge->dx, merge->dy, merge->mblend ) )
return( -1 );
break;
default:
g_assert( 0 );
}
return( 0 );
}
示例14: vips_foreign_load_webp_build
static int
vips_foreign_load_webp_build( VipsObject *object )
{
if( VIPS_OBJECT_CLASS( vips_foreign_load_webp_parent_class )->
build( object ) )
return( -1 );
return( 0 );
}
示例15: vips_scale_build
static int
vips_scale_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsScale *scale = (VipsScale *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 7 );
double mx;
double mn;
if( VIPS_OBJECT_CLASS( vips_scale_parent_class )->build( object ) )
return( -1 );
if( vips_stats( scale->in, &t[0], NULL ) )
return( -1 );
mn = *VIPS_MATRIX( t[0], 0, 0 );
mx = *VIPS_MATRIX( t[0], 1, 0 );
if( mn == mx ) {
/* Range of zero: just return black.
*/
if( vips_black( &t[1], scale->in->Xsize, scale->in->Ysize,
"bands", scale->in->Bands,
NULL ) ||
vips_image_write( t[1], conversion->out ) )
return( -1 );
}
else if( scale->log ) {
double f = 255.0 / log10( 1.0 + pow( mx, scale->exp ) );
if( vips_pow_const1( scale->in, &t[2], scale->exp, NULL ) ||
vips_linear1( t[2], &t[3], 1.0, 1.0, NULL ) ||
vips_log10( t[3], &t[4], NULL ) ||
vips_linear1( t[4], &t[5], f, 0.0,
"uchar", TRUE,
NULL ) ||
vips_image_write( t[5], conversion->out ) )
return( -1 );
}
else {
double f = 255.0 / (mx - mn);
/* Add .5 to get round-to-nearest.
*/
double a = -(mn * f) + 0.5;
if( vips_linear1( scale->in, &t[2], f, a,
"uchar", TRUE,
NULL ) ||
vips_image_write( t[2], conversion->out ) )
return( -1 );
}
return( 0 );
}