4 char evalstr[]="Description string of plugin dyntest - kind of like";
6 void null_plug(void *ptr) { }
8 /* Example dynamic filter - level stretch (linear) - note it only stretches and doesn't compress */
16 output pixel value calculated by: o=((i-a)*255)/(b-a);
18 note that since we do not have the needed functions to manipulate the data structures *** YET ***
25 if (in>255) { return 255; }
26 else if (in>0) return in;
30 void lin_stretch(void *INP) {
40 if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); }
41 if ( !getINT("a",&a) ) { fprintf(stderr,"Error: a is missing\n"); }
42 if ( !getINT("b",&b) ) { fprintf(stderr,"Error: b is missing\n"); }
44 /* fprintf(stderr,"parameters: (im 0x%x,a %d,b %d)\n",im,a,b);*/
48 for(i=0;i<4;i++) { printf("%d: %" i_DF "\n", i, i_DFc(info[i])); }
49 printf("image info:\n size (" i_DFp ")\n channels (%d)\n",
50 i_DFcp(im->xsize, im->ysize), im->channels);
52 for(y=0;y<im->ysize;y++) for(x=0;x<im->xsize;x++) {
53 i_gpix(im,x,y,&rcolor);
54 for(i=0;i<im->channels;i++) rcolor.channel[i]=saturate((255*(rcolor.channel[i]-a))/(b-a));
55 i_ppix(im,x,y,&rcolor);
60 func_ptr function_list[]={
64 "callsub => sub { 1; }"
68 "callseq => ['image','a','b'], \
69 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,1,\\%hsh); } \
75 /* Remember to double backslash backslashes within Double quotes in C */