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 ); }
static int vips_point_build( VipsObject *object ) { VipsCreate *create = VIPS_CREATE( object ); VipsPoint *point = VIPS_POINT( object ); VipsPointClass *class = VIPS_POINT_GET_CLASS( point ); VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 ); VipsImage *in; if( VIPS_OBJECT_CLASS( vips_point_parent_class )->build( object ) ) return( -1 ); t[0] = vips_image_new(); vips_image_init_fields( t[0], point->width, point->height, 1, VIPS_FORMAT_FLOAT, VIPS_CODING_NONE, class->interpretation, 1.0, 1.0 ); vips_image_pipelinev( t[0], VIPS_DEMAND_STYLE_ANY, NULL ); if( vips_image_generate( t[0], NULL, vips_point_gen, NULL, point, NULL ) ) return( -1 ); in = t[0]; if( point->uchar ) { float min = class->min; float max = class->max; float range = max - min; if( vips_linear1( in, &t[2], 255.0 / range, -min * 255.0 / range, "uchar", TRUE, NULL ) ) return( -1 ); in = t[2]; /* We don't want FOURIER or whatever in this case. */ in->Type = VIPS_INTERPRETATION_MULTIBAND; }
static int vips_gaussnoise_build( VipsObject *object ) { VipsCreate *create = VIPS_CREATE( object ); VipsGaussnoise *gaussnoise = (VipsGaussnoise *) object; if( VIPS_OBJECT_CLASS( vips_gaussnoise_parent_class )->build( object ) ) return( -1 ); vips_image_init_fields( create->out, gaussnoise->width, gaussnoise->height, 1, VIPS_FORMAT_FLOAT, 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, NULL, vips_gaussnoise_gen, NULL, gaussnoise, NULL ) ) return( -1 ); return( 0 ); }
static int vips_black_build( VipsObject *object ) { VipsCreate *create = VIPS_CREATE( object ); VipsBlack *black = (VipsBlack *) object; if( VIPS_OBJECT_CLASS( vips_black_parent_class )->build( object ) ) return( -1 ); vips_image_init_fields( create->out, black->width, black->height, black->bands, VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, black->bands == 1 ? VIPS_INTERPRETATION_B_W : VIPS_INTERPRETATION_MULTIBAND, 1.0, 1.0 ); vips_image_pipelinev( create->out, VIPS_DEMAND_STYLE_ANY, NULL ); if( vips_image_generate( create->out, NULL, vips_black_gen, NULL, NULL, NULL ) ) return( -1 ); return( 0 ); }
dims[0] = x; for( i = 0; i < xyz->dimensions; i++ ) q[i] = dims[i]; q += xyz->dimensions; } } return( 0 ); } static int vips_xyz_build( VipsObject *object ) { VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsCreate *create = VIPS_CREATE( object ); VipsXyz *xyz = (VipsXyz *) object; double d; int ysize; if( VIPS_OBJECT_CLASS( vips_xyz_parent_class )->build( object ) ) return( -1 ); if( (vips_object_argument_isset( object, "dsize" ) && !vips_object_argument_isset( object, "csize" )) || (vips_object_argument_isset( object, "esize" ) && !vips_object_argument_isset( object, "dsize" )) ) { vips_error( class->nickname, "%s", _( "lower dimensions not set" ) ); return( -1 );