]> git.imager.perl.org - imager.git/blame - dynfilt/dt2.c
compiler warning cleanup
[imager.git] / dynfilt / dt2.c
CommitLineData
02d1d628
AMH
1#include "pluginst.h"
2#include <stdio.h>
3
4char evalstr[]="Plugin for creating html tables from images";
5
6/* input parameters
7 fname - file to add the html to.
8
9*/
10
11
12
13void
14html_art(void *INP) {
15 i_img *im;
16 i_color rcolor;
919e0000 17 int x,y;
02d1d628
AMH
18 FILE *fp;
19 char *fname;
20
21 if ( !getSTR("fname",&fname) ) { fprintf(stderr,"Error: filename is missing\n"); return; }
22 if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); return; }
23
919e0000 24 printf("parameters: (im 0x%p,fname %s)\n",im,fname);
02d1d628
AMH
25
26 printf("image info:\n size (%d,%d)\n channels (%d)\n channel mask (%d)\n bytes (%d)\n",im->xsize,im->ysize,im->channels,im->ch_mask,im->bytes);
27
28 fp=fopen(fname,"ab+");
29 fprintf(fp,"<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
30 for(y=0;y<im->ysize;y+=2) {
31 fprintf(fp,"<TR>");
32 for(x=0;x<im->xsize;x++) {
33 i_gpix(im,x,y,&rcolor);
34 fprintf(fp,"<TD BGCOLOR=\"#%02X%02X%02X\">&nbsp;&nbsp;</TD>",rcolor.rgb.r,rcolor.rgb.g,rcolor.rgb.b);
35 }
36 fprintf(fp,"</TR>");
37 }
38 fprintf(fp,"</TABLE>");
39 fclose(fp);
40}
41
42func_ptr function_list[]={
43 {
44 "html_art",
45 html_art,
46 "callseq => ['image','fname'], \
47 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,0,\\%hsh); } \
48 "
49 },
50 {NULL,NULL,NULL}};
51
52
53/* Remember to double backslash backslashes within Double quotes in C */