… | |
… | |
21 | #include "psiconv/data.h" |
21 | #include "psiconv/data.h" |
22 | #include "gen.h" |
22 | #include "gen.h" |
23 | #include <string.h> |
23 | #include <string.h> |
24 | #include "psiconv.h" |
24 | #include "psiconv.h" |
25 | |
25 | |
26 | #if IMAGEMAGICK |
26 | #ifdef IMAGEMAGICK |
27 | #include "magick-aux.h" |
27 | #include "magick-aux.h" |
28 | #include <magick/magick.h> |
28 | #include <magick/magick.h> |
|
|
29 | |
|
|
30 | #ifdef DMALLOC |
|
|
31 | #include "dmalloc.h" |
|
|
32 | #endif |
29 | |
33 | |
30 | static void set_filename(char *dest,const char *type, const char *name) |
34 | static void set_filename(char *dest,const char *type, const char *name) |
31 | { |
35 | { |
32 | int len; |
36 | int len; |
33 | strcpy(dest,type); |
37 | strcpy(dest,type); |
… | |
… | |
60 | } |
64 | } |
61 | } |
65 | } |
62 | |
66 | |
63 | image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,&exc); |
67 | image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,&exc); |
64 | if (! image) { |
68 | if (! image) { |
65 | MagickError(exc.severity,exc.message,exc.qualifier); |
69 | MagickError(exc.severity,exc.reason,exc.description); |
66 | } |
70 | } |
67 | free(pixel); |
71 | free(pixel); |
68 | |
72 | |
69 | return image; |
73 | return image; |
70 | } |
74 | } |
… | |
… | |
74 | static int psiconv_gen_image_clipart(const char *filename, psiconv_clipart_f f, |
78 | static int psiconv_gen_image_clipart(const char *filename, psiconv_clipart_f f, |
75 | const char *dest) |
79 | const char *dest) |
76 | { |
80 | { |
77 | #if IMAGEMAGICK |
81 | #if IMAGEMAGICK |
78 | psiconv_clipart_section section; |
82 | psiconv_clipart_section section; |
79 | MagickInfo *mi = GetMagickInfo(dest); |
83 | const MagickInfo *mi; |
80 | ImageInfo *image_info; |
84 | ImageInfo *image_info; |
81 | Image *image = NULL; |
85 | Image *image = NULL; |
82 | Image *last_image = NULL; |
86 | Image *last_image = NULL; |
83 | Image *this_image, *images; |
87 | Image *this_image, *images; |
84 | ExceptionInfo exc; |
88 | ExceptionInfo exc; |
85 | int i; |
89 | int i; |
86 | unsigned int status; |
90 | unsigned int status; |
|
|
91 | |
|
|
92 | GetExceptionInfo(&exc); |
|
|
93 | if (!(mi = GetMagickInfo(dest,&exc))) |
|
|
94 | return -1; |
87 | |
95 | |
88 | if ((psiconv_list_length(f->sections) < 1) || |
96 | if ((psiconv_list_length(f->sections) < 1) || |
89 | ((psiconv_list_length(f->sections)) > 1 && ! (mi->adjoin))) |
97 | ((psiconv_list_length(f->sections)) > 1 && ! (mi->adjoin))) |
90 | #endif |
98 | #endif |
91 | return -1; |
99 | return -1; |
… | |
… | |
100 | this_image->previous=last_image; |
108 | this_image->previous=last_image; |
101 | } |
109 | } |
102 | last_image = this_image; |
110 | last_image = this_image; |
103 | } |
111 | } |
104 | |
112 | |
105 | GetExceptionInfo(&exc); |
|
|
106 | image_info = CloneImageInfo(NULL); |
113 | image_info = CloneImageInfo(NULL); |
107 | set_filename(image->filename,dest,filename); |
114 | set_filename(image->filename,dest,filename); |
108 | if (image->next) |
115 | if (image->next) |
109 | images = CoalesceImages(image,&exc); |
116 | images = CoalesceImages(image,&exc); |
110 | else |
117 | else |
… | |
… | |
127 | const char *dest) |
134 | const char *dest) |
128 | { |
135 | { |
129 | |
136 | |
130 | #if IMAGEMAGICK |
137 | #if IMAGEMAGICK |
131 | psiconv_paint_data_section section; |
138 | psiconv_paint_data_section section; |
132 | MagickInfo *mi = GetMagickInfo(dest); |
139 | const MagickInfo *mi; |
133 | ImageInfo *image_info; |
140 | ImageInfo *image_info; |
134 | Image *image = NULL; |
141 | Image *image = NULL; |
135 | Image *last_image = NULL; |
142 | Image *last_image = NULL; |
136 | Image *this_image, *images; |
143 | Image *this_image, *images; |
137 | ExceptionInfo exc; |
144 | ExceptionInfo exc; |
138 | int i; |
145 | int i; |
139 | unsigned int status; |
146 | unsigned int status; |
|
|
147 | |
|
|
148 | GetExceptionInfo(&exc); |
|
|
149 | if (!(mi = GetMagickInfo(dest,&exc))) |
|
|
150 | return -1; |
140 | |
151 | |
141 | if ((psiconv_list_length(f->sections) < 1) || |
152 | if ((psiconv_list_length(f->sections) < 1) || |
142 | ((psiconv_list_length(f->sections)) > 1 && ! (mi->adjoin))) |
153 | ((psiconv_list_length(f->sections)) > 1 && ! (mi->adjoin))) |
143 | #endif |
154 | #endif |
144 | return -1; |
155 | return -1; |
… | |
… | |
154 | this_image->previous=last_image; |
165 | this_image->previous=last_image; |
155 | } |
166 | } |
156 | last_image = this_image; |
167 | last_image = this_image; |
157 | } |
168 | } |
158 | |
169 | |
159 | GetExceptionInfo(&exc); |
|
|
160 | image_info = CloneImageInfo(NULL); |
170 | image_info = CloneImageInfo(NULL); |
161 | set_filename(image->filename,dest,filename); |
171 | set_filename(image->filename,dest,filename); |
162 | if (image->next) |
172 | if (image->next) |
163 | images = CoalesceImages(image,&exc); |
173 | images = CoalesceImages(image,&exc); |
164 | else |
174 | else |
… | |
… | |
209 | |
219 | |
210 | void init_image(void) |
220 | void init_image(void) |
211 | { |
221 | { |
212 | struct psiconv_fileformat_s ff; |
222 | struct psiconv_fileformat_s ff; |
213 | #if IMAGEMAGICK |
223 | #if IMAGEMAGICK |
214 | MagickInfo *mi; |
224 | const MagickInfo *mi; |
215 | ff.output = psiconv_gen_image; |
225 | ff.output = psiconv_gen_image; |
216 | for (mi = GetMagickFileList(); mi ; mi = mi->next) { |
226 | for (mi = GetMagickFileList(); mi ; mi = mi->next) { |
217 | if (mi->encoder) { |
227 | if (mi->encoder) { |
218 | ff.name = strdup(mi->tag); |
228 | ff.name = strdup(mi->name); |
219 | ff.description = strdup(mi->description); |
229 | ff.description = strdup(mi->description); |
220 | psiconv_list_add(fileformat_list,&ff); |
230 | psiconv_list_add(fileformat_list,&ff); |
221 | } |
231 | } |
222 | } |
232 | } |
223 | #endif |
233 | #endif |