1 | /* |
1 | /* |
2 | * gen_image.c - Part of psiconv, a PSION 5 file formats converter |
2 | * gen_image.c - Part of psiconv, a PSION 5 file formats converter |
3 | * Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl> |
3 | * Copyright (c) 1999-2005 Frodo Looijaard <frodo@frodo.looijaard.name> |
4 | * |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
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 |
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 |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
8 | * (at your option) any later version. |
… | |
… | |
24 | #include <string.h> |
24 | #include <string.h> |
25 | #include <stdlib.h> |
25 | #include <stdlib.h> |
26 | |
26 | |
27 | #ifdef IMAGEMAGICK |
27 | #ifdef IMAGEMAGICK |
28 | #include "magick-aux.h" |
28 | #include "magick-aux.h" |
29 | #include <magick/magick.h> |
|
|
30 | #endif |
29 | #endif |
31 | |
30 | |
32 | #ifdef DMALLOC |
31 | #ifdef DMALLOC |
33 | #include "dmalloc.h" |
32 | #include "dmalloc.h" |
34 | #endif |
33 | #endif |
35 | |
34 | |
|
|
35 | #ifdef IMAGEMAGICK |
36 | static Image *get_paint_data_section(psiconv_paint_data_section sec); |
36 | static Image *get_paint_data_section(psiconv_paint_data_section sec); |
37 | static void image_to_list(psiconv_list list,Image *image,const char *dest); |
37 | static void image_to_list(psiconv_list list,Image *image,const char *dest); |
38 | static void gen_image_list(const psiconv_config config,psiconv_list list, |
38 | static void gen_image_list(const psiconv_config config,psiconv_list list, |
39 | const psiconv_list sections, const char *dest); |
39 | const psiconv_list sections, const char *dest); |
40 | static void gen_clipart(const psiconv_config config,psiconv_list list, |
40 | static void gen_clipart(const psiconv_config config,psiconv_list list, |
41 | const psiconv_clipart_f f, const char *dest); |
41 | const psiconv_clipart_f f, const char *dest); |
42 | static void gen_mbm(const psiconv_config config,psiconv_list list, |
42 | static void gen_mbm(const psiconv_config config,psiconv_list list, |
43 | const psiconv_mbm_f f, const char *dest); |
43 | const psiconv_mbm_f f, const char *dest); |
44 | static void gen_sketch(const psiconv_config config,psiconv_list list, |
44 | static void gen_sketch(const psiconv_config config,psiconv_list list, |
45 | const psiconv_sketch_f f, const char *dest); |
45 | const psiconv_sketch_f f, const char *dest); |
|
|
46 | static int gen_image(psiconv_config config, psiconv_list list, |
|
|
47 | const psiconv_file file, const char *dest, |
|
|
48 | const encoding encoding_type); |
46 | |
49 | |
47 | /* This is ridiculously simple using ImageMagick. Without it, it would |
50 | /* This is ridiculously simple using ImageMagick. Without it, it would |
48 | be quite somewhat harder - it will be left for later on. |
51 | be quite somewhat harder - it will be left for later on. |
49 | Note that we ignore any errors. Dangerous... */ |
52 | Note that we ignore any errors. Dangerous... */ |
50 | |
53 | |
… | |
… | |
207 | image_to_list(list,image,dest); |
210 | image_to_list(list,image,dest); |
208 | DestroyImage(image); |
211 | DestroyImage(image); |
209 | } |
212 | } |
210 | |
213 | |
211 | |
214 | |
212 | static int gen_image(psiconv_config config, psiconv_list list, |
215 | int gen_image(psiconv_config config, psiconv_list list, |
213 | const psiconv_file file, const char *dest, |
216 | const psiconv_file file, const char *dest, |
214 | const encoding encoding_type) |
217 | const encoding encoding_type) |
215 | { |
218 | { |
216 | if (file->type == psiconv_mbm_file) |
219 | if (file->type == psiconv_mbm_file) |
217 | gen_mbm(config,list,(psiconv_mbm_f) file->file,dest); |
220 | gen_mbm(config,list,(psiconv_mbm_f) file->file,dest); |
… | |
… | |
223 | gen_sketch(config, list,(psiconv_sketch_f) file->file,dest); |
226 | gen_sketch(config, list,(psiconv_sketch_f) file->file,dest); |
224 | } else |
227 | } else |
225 | return -1; |
228 | return -1; |
226 | return 0; |
229 | return 0; |
227 | } |
230 | } |
|
|
231 | |
|
|
232 | #endif |
228 | |
233 | |
229 | void init_image(void) |
234 | void init_image(void) |
230 | { |
235 | { |
231 | struct fileformat_s ff; |
236 | struct fileformat_s ff; |
232 | #if IMAGEMAGICK |
237 | #if IMAGEMAGICK |