… | |
… | |
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 | #if IMAGEMAGICK |
|
|
27 | #include "magick-aux.h" |
27 | #include <magick/magick.h> |
28 | #include <magick/magick.h> |
28 | |
29 | |
29 | /* This is ridiculously simple using ImageMagick. Without it, it would |
30 | /* This is ridiculously simple using ImageMagick. Without it, it would |
30 | be quite somewhat harder - it will be left for later on */ |
31 | be quite somewhat harder - it will be left for later on. |
|
|
32 | Note that we ignore any errors. Dangerous... */ |
31 | |
33 | |
32 | static Image *get_paint_data_section(psiconv_paint_data_section sec) |
34 | static Image *get_paint_data_section(psiconv_paint_data_section sec) |
33 | { |
35 | { |
34 | Image *image; |
36 | Image *image; |
35 | image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green, |
37 | float *pixel, *p, *red, *green, *blue; |
36 | sec->blue,NULL); |
38 | int x,y; |
|
|
39 | ExceptionInfo *exc; |
|
|
40 | |
|
|
41 | GetExceptionInfo(exc); |
|
|
42 | red = sec->red; |
|
|
43 | green = sec->green; |
|
|
44 | blue = sec->blue; |
|
|
45 | p = pixel = malloc(sec->xsize * sec->ysize * 3 * sizeof(float)); |
|
|
46 | for (y = 0; y < sec->ysize; y++) { |
|
|
47 | for (x = 0; x < sec->xsize; x++) { |
|
|
48 | *p++ = *red++; |
|
|
49 | *p++ = *green++; |
|
|
50 | *p++ = *blue++; |
|
|
51 | } |
|
|
52 | } |
|
|
53 | image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,exc); |
|
|
54 | free(pixel); |
|
|
55 | DestroyExceptionInfo(exc); |
|
|
56 | |
37 | return image; |
57 | return image; |
38 | } |
58 | } |
39 | |
59 | |
40 | #endif |
60 | #endif |
41 | |
61 | |
… | |
… | |
151 | { |
171 | { |
152 | struct psiconv_fileformat ff; |
172 | struct psiconv_fileformat ff; |
153 | #if IMAGEMAGICK |
173 | #if IMAGEMAGICK |
154 | MagickInfo *mi; |
174 | MagickInfo *mi; |
155 | ff.output = psiconv_gen_image; |
175 | ff.output = psiconv_gen_image; |
156 | for (mi = GetMagickInfo(NULL); mi ; mi = mi->next) { |
176 | for (mi = GetMagickFileList(); mi ; mi = mi->next) { |
157 | if (mi->encoder) { |
177 | if (mi->encoder) { |
158 | ff.name = strdup(mi->tag); |
178 | ff.name = strdup(mi->tag); |
159 | ff.description = strdup(mi->description); |
179 | ff.description = strdup(mi->description); |
160 | psiconv_list_add(fileformat_list,&ff); |
180 | psiconv_list_add(fileformat_list,&ff); |
161 | } |
181 | } |