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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations)
Tue Nov 30 00:24:35 1999 UTC (24 years, 4 months ago) by frodo
File MIME type: text/plain
File size: 2107 byte(s)
(Frodo) Yet another forgotten file. This is getting boring...

1 frodo 32 /*
2     * gen_image.c - Part of psiconv, a PSION 5 file formats converter
3     * Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl>
4     *
5     * This program is free software; you can redistribute it and/or modify
6     * it under the terms of the GNU General Public License as published by
7     * the Free Software Foundation; either version 2 of the License, or
8     * (at your option) any later version.
9     *
10     * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18     */
19    
20     #include "config.h"
21     #include "data.h"
22     #include "gen.h"
23     #include <string.h>
24    
25     #if IMAGEMAGICK
26     #include <magick/magick.h>
27     #endif
28    
29     /* This is ridiculously simple using ImageMagick. Without it, it would
30     be somewhat more hard - it will be left for later on */
31    
32     static void gen_paint_data_section(FILE *of, psiconv_paint_data_section sec)
33     {
34     #if IMAGEMAGICK
35     ImageInfo image_info;
36     Image *image;
37    
38     image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green,
39     sec->blue,NULL);
40     GetImageInfo(&image_info);
41     image_info.file = of;
42     strcpy(image->filename, "bmp:test.bmp");
43     WriteImage(&image_info,image);
44     #endif
45     }
46    
47     static void psiconv_gen_image_mbm(FILE *of, psiconv_mbm_f f)
48     {
49     psiconv_paint_data_section section;
50     if (psiconv_list_length(f->sections) >= 1) {
51     section = psiconv_list_get(f->sections,0);
52     gen_paint_data_section(of,section);
53     }
54     }
55    
56     static void psiconv_gen_image_sketch(FILE *of, psiconv_sketch_f f)
57     {
58     gen_paint_data_section(of,f->sketch_sec->picture);
59     }
60    
61     void psiconv_gen_image(FILE * of, psiconv_file file)
62     {
63     if (file->type == psiconv_mbm_file)
64     psiconv_gen_image_mbm(of,(psiconv_mbm_f) file->file);
65     else if (file->type == psiconv_sketch_file)
66     psiconv_gen_image_sketch(of,(psiconv_sketch_f) file->file);
67     }
68    

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