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) {
38 if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); }
39 if ( !getINT("a",&a) ) { fprintf(stderr,"Error: a is missing\n"); }
40 if ( !getINT("b",&b) ) { fprintf(stderr,"Error: b is missing\n"); }
42 /* fprintf(stderr,"parameters: (im 0x%x,a %d,b %d)\n",im,a,b);*/
46 for(i=0;i<4;i++) { printf("%d: %d\n",i,info[i]); }
47 printf("image info:\n size (%d,%d)\n channels (%d)\n",
48 im->xsize, im->ysize, im->channels);
50 for(y=0;y<im->ysize;y++) for(x=0;x<im->xsize;x++) {
51 i_gpix(im,x,y,&rcolor);
52 for(i=0;i<im->channels;i++) rcolor.channel[i]=saturate((255*(rcolor.channel[i]-a))/(b-a));
53 i_ppix(im,x,y,&rcolor);
58 func_ptr function_list[]={
62 "callsub => sub { 1; }"
66 "callseq => ['image','a','b'], \
67 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,1,\\%hsh); } \
73 /* Remember to double backslash backslashes within Double quotes in C */