~ubuntu-branches/ubuntu/trusty/vips/trusty

« back to all changes in this revision

Viewing changes to libvips/iofuncs/generate.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2014-03-29 12:29:29 UTC
  • mfrom: (1.1.21) (30.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20140329122929-fvxnaann32ex0gzk
Tags: 7.38.5-2
Enable dh-autoreconf. (Closes: #742872)

Show diffs side-by-side

added added

removed removed

Lines of Context:
274
274
        return( result );
275
275
}
276
276
 
277
 
/**
278
 
 * vips_demand_hint_array: 
279
 
 * @image: image to set hint for
280
 
 * @hint: hint for this image
281
 
 * @in: array of input images to this operation
282
 
 *
283
 
 * Operations can set demand hints, that is, hints to the VIPS IO system about
284
 
 * the type of region geometry this operation works best with. For example,
285
 
 * operations which transform coordinates will usually work best with
286
 
 * %VIPS_DEMAND_STYLE_SMALLTILE, operations which work on local windows of 
287
 
 * pixels will like %VIPS_DEMAND_STYLE_FATSTRIP.
288
 
 *
289
 
 * VIPS uses the list of input images to build the tree of operations it needs
290
 
 * for the cache invalidation system. You have to call this function, or its
291
 
 * varargs friend vips_demand_hint().
292
 
 *
293
 
 * See also: vips_demand_hint(), vips_image_generate().
 
277
/* We have to have this as a separate entry point so we can support the old
 
278
 * vips7 API.
294
279
 */
295
280
void 
296
 
vips_demand_hint_array( VipsImage *image, VipsDemandStyle hint, VipsImage **in )
 
281
vips__demand_hint_array( VipsImage *image, 
 
282
        VipsDemandStyle hint, VipsImage **in )
297
283
{
298
284
        int i, len, nany;
299
285
        VipsDemandStyle set_hint;
327
313
        image->dhint = set_hint;
328
314
 
329
315
#ifdef DEBUG
330
 
        printf( "vips_demand_hint_array: set dhint for \"%s\" to %s\n",
 
316
        printf( "vips_image_pipeline_array: set dhint for \"%s\" to %s\n",
331
317
                image->filename, 
332
318
                vips_enum_nick( VIPS_TYPE_DEMAND_STYLE, image->dhint ) );
333
319
        printf( "\toperation requested %s\n", 
354
340
}
355
341
 
356
342
/**
357
 
 * vips_demand_hint:
358
 
 * @image: image to set hint for
 
343
 * vips_image_pipeline_array: 
 
344
 * @image: output image
 
345
 * @hint: demand hint for @image
 
346
 * @in: %NULL-terminated array of input images 
 
347
 *
 
348
 * Add an image to a pipeline. @image depends on all of the images in @in,
 
349
 * @image prefers to supply pixels according to @hint.
 
350
 *
 
351
 * Operations can set demand hints, that is, hints to the VIPS IO system about
 
352
 * the type of region geometry this operation works best with. For example,
 
353
 * operations which transform coordinates will usually work best with
 
354
 * %VIPS_DEMAND_STYLE_SMALLTILE, operations which work on local windows of 
 
355
 * pixels will like %VIPS_DEMAND_STYLE_FATSTRIP.
 
356
 *
 
357
 * Header fields in @image are set from the fields in @in, with lower-numbered
 
358
 * images in @in taking priority. 
 
359
 * For example, if @in[0] and @in[1] both have an item
 
360
 * called "icc-profile", it's the profile attached to @in[0] that will end up
 
361
 * on @image.
 
362
 * Image history is completely copied from all @in. @image will have the history
 
363
 * of all the input images.
 
364
 * The array of input images can be empty, meaning @image is at the start of a
 
365
 * pipeline.
 
366
 *
 
367
 * VIPS uses the list of input images to build the tree of operations it needs
 
368
 * for the cache invalidation system. 
 
369
 *
 
370
 * See also: vips_image_pipelinev(), vips_image_generate().
 
371
 *
 
372
 * Returns: 0 on success, -1 on error.
 
373
 */
 
374
int 
 
375
vips_image_pipeline_array( VipsImage *image, 
 
376
        VipsDemandStyle hint, VipsImage **in )
 
377
{
 
378
        vips__demand_hint_array( image, hint, in );
 
379
 
 
380
        if( in[0] && 
 
381
                vips__image_copy_fields_array( image, in ) )
 
382
                return( -1 ); 
 
383
 
 
384
        return( 0 );
 
385
}
 
386
 
 
387
/**
 
388
 * vips_image_pipelinev:
 
389
 * @image: output image of pipeline
359
390
 * @hint: hint for this image
360
 
 * @Varargs: %NULL-terminated list of input images to this operation
361
 
 *
362
 
 * Build an array and call vips_demand_hint_array().
363
 
 *
364
 
 * See also: vips_demand_hint(), vips_image_generate().
 
391
 * @...: %NULL-terminated list of input images 
 
392
 *
 
393
 * Build an array and call vips_image_pipeline_array().
 
394
 *
 
395
 * See also: vips_image_generate().
365
396
 */
366
 
void 
367
 
vips_demand_hint( VipsImage *image, VipsDemandStyle hint, ... )
 
397
int 
 
398
vips_image_pipelinev( VipsImage *image, VipsDemandStyle hint, ... )
368
399
{
369
400
        va_list ap;
370
401
        int i;
376
407
                ;
377
408
        va_end( ap );
378
409
        if( i == MAX_IMAGES ) {
379
 
                vips_warn( "vips_demand_hint", "%s", _( "too many images" ) );
 
410
                vips_warn( "vips_image_pipeline", "%s", _( "too many images" ) );
380
411
 
381
412
                /* Make sure we have a sentinel there.
382
413
                 */
383
414
                ar[i - 1] = NULL;
384
415
        }
385
416
 
386
 
        vips_demand_hint_array( image, hint, ar );
 
417
        return( vips_image_pipeline_array( image, hint, ar ) );
387
418
}
388
419
 
389
420
/**