/[public]/psiconv/trunk/program/psiconv/gen_image.c
ViewVC logotype

Diff of /psiconv/trunk/program/psiconv/gen_image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 38 Revision 39
28#endif 28#endif
29 29
30/* This is ridiculously simple using ImageMagick. Without it, it would 30/* This is ridiculously simple using ImageMagick. Without it, it would
31 be quite somewhat harder - it will be left for later on */ 31 be quite somewhat harder - it will be left for later on */
32 32
33static void gen_paint_data_section(FILE *of, psiconv_paint_data_section sec, 33static Image *get_paint_data_section(psiconv_paint_data_section sec)
34{
35 Image *image;
36 image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green,
37 sec->blue,NULL);
38 return image;
39}
40
41
42static int psiconv_gen_image_mbm(FILE *of, psiconv_mbm_f f, const char *dest)
43{
44#if IMAGEMAGICK
45 psiconv_paint_data_section section;
46 MagickInfo *mi = GetMagickInfo(dest);
47 ImageInfo image_info;
48 Image *image = NULL;
49 Image *last_image = NULL;
50 Image *this_image;
51 int i;
52
53 if ((psiconv_list_length(f->sections) < 1) ||
54 ((psiconv_list_length(f->sections)) > 1 && ! (mi->adjoin)))
55#endif
56 return -1;
57#if IMAGEMAGICK
58 for (i = 0; i < psiconv_list_length(f->sections); i++) {
59 section = psiconv_list_get(f->sections,0);
60 this_image = get_paint_data_section(section);
61 if (! image) {
62 image = image;
63 last_image = image;
64 } else {
65 last_image->next=this_image;
66 this_image->previous=last_image;
67 }
68 }
69
70 GetImageInfo(&image_info);
71 image_info.file = of;
72 strcpy(image->magick, dest);
73 WriteImage(&image_info,image);
74 return 0;
75#endif
76}
77
78static void psiconv_gen_image_sketch(FILE *of, psiconv_sketch_f f,
34 const char *dest) 79 const char *dest)
35{ 80{
36#if IMAGEMAGICK 81#if IMAGEMAGICK
37 ImageInfo image_info; 82 ImageInfo image_info;
38 Image *image; 83 Image *image;
39 84
40 image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green, 85 image = get_paint_data_section(f->sketch_sec->picture);
41 sec->blue,NULL);
42 GetImageInfo(&image_info); 86 GetImageInfo(&image_info);
43 image_info.file = of; 87 image_info.file = of;
44 strcpy(image->magick, dest); 88 strcpy(image->magick, dest);
45 WriteImage(&image_info,image); 89 WriteImage(&image_info,image);
46#endif 90#endif
47}
48
49static int psiconv_gen_image_mbm(FILE *of, psiconv_mbm_f f, const char *dest)
50{
51 psiconv_paint_data_section section;
52#if IMAGEMAGICK
53 MagickInfo *mi = GetMagickInfo(dest);
54#endif
55 if (psiconv_list_length(f->sections) == 1) {
56 section = psiconv_list_get(f->sections,0);
57 gen_paint_data_section(of,section,dest);
58 return 0;
59#if IMAGEMAGICK
60 } else if ((mi->adjoin) && (psiconv_list_length(f->sections) >= 1)) {
61 /* Not yet supported... */
62 return -1;
63#endif
64 } else
65 return -1;
66}
67
68static void psiconv_gen_image_sketch(FILE *of, psiconv_sketch_f f,
69 const char * dest)
70{
71 gen_paint_data_section(of,f->sketch_sec->picture,dest);
72} 91}
73 92
74static int psiconv_gen_image(FILE * of, const psiconv_file file, 93static int psiconv_gen_image(FILE * of, const psiconv_file file,
75 const char *dest) 94 const char *dest)
76{ 95{

Legend:
Removed from v.38  
changed lines
  Added in v.39

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26