add missing va_end() in bmp.c's write_packed()
[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;
8d14daab 17 i_img_dim 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
8d14daab 24 printf("parameters: (im %p,fname %s)\n",im,fname);
02d1d628 25
8d14daab
TC
26 printf("image info:\n size ("i_DFp ")\n channels (%d)\n",
27 i_DFcp(im->xsize, im->ysize), im->channels);
02d1d628
AMH
28
29 fp=fopen(fname,"ab+");
30 fprintf(fp,"<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
31 for(y=0;y<im->ysize;y+=2) {
32 fprintf(fp,"<TR>");
33 for(x=0;x<im->xsize;x++) {
34 i_gpix(im,x,y,&rcolor);
35 fprintf(fp,"<TD BGCOLOR=\"#%02X%02X%02X\">&nbsp;&nbsp;</TD>",rcolor.rgb.r,rcolor.rgb.g,rcolor.rgb.b);
36 }
37 fprintf(fp,"</TR>");
38 }
39 fprintf(fp,"</TABLE>");
40 fclose(fp);
41}
42
43func_ptr function_list[]={
44 {
45 "html_art",
46 html_art,
47 "callseq => ['image','fname'], \
48 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,0,\\%hsh); } \
49 "
50 },
51 {NULL,NULL,NULL}};
52
53
54/* Remember to double backslash backslashes within Double quotes in C */