[f48183]: src / vips / plug.c  Maximize  Restore  History

Download this file

70 lines (55 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
#include <vips/vips.h>
#include "transform.h"
int transform_image_build( IMAGE *out, pt_transform *trn,
const int xsize, const int ysize );
static int
transform_image_build_vec( im_object *argv )
{
IMAGE *out = argv[0];
char *transform = argv[1];
/*These two variable are not necessary now, as we are getting the width and height
from pt_script */
int width = *((int*)argv[2]);
int height = *((int*)argv[3]);
pt_transform *trn;
/*width and height will be loaded from pt_script */
if( !(trn = transform_new_from_file( transform, &width, &height )) ) {
im_error( "transform_image_build",
_( "unable to build transform" ) );
return( -1 );
}
if( im_add_close_callback( out,
(im_callback_fn) transform_destroy, trn, NULL ) ) {
transform_destroy( trn );
return( -1 );
}
if( transform_image_build( out, trn, width, height ) )
return( -1 );
return( 0 );
}
static im_arg_desc transform_image_build_arg_types[] = {
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_STRING( "transform" ),
IM_INPUT_INT( "width" ),
IM_INPUT_INT( "height" )
};
static im_function transform_image_build_desc = {
"transform_image_build", /* Name */
"build a transform image", /* Description */
0, /* Flags */
transform_image_build_vec, /* Dispatch function */
IM_NUMBER( transform_image_build_arg_types ),/* Size of arg list */
transform_image_build_arg_types /* Arg list */
};
static im_function *function_list[] = {
&transform_image_build_desc
};
/* Define the package_table symbol. This is what VIPS looks for when loading
* the plugin.
*/
G_MODULE_EXPORT im_package package_table = {
"transform", /* Package name */
IM_NUMBER( function_list ), /* Function list */
function_list
};