… | |
… | |
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/magick.h> |
27 | #include <magick/magick.h> |
28 | #endif |
|
|
29 | |
28 | |
30 | /* This is ridiculously simple using ImageMagick. Without it, it would |
29 | /* This is ridiculously simple using ImageMagick. Without it, it would |
31 | be quite somewhat harder - it will be left for later on */ |
30 | be quite somewhat harder - it will be left for later on. |
|
|
31 | Note that we ignore any errors. Dangerous... */ |
32 | |
32 | |
33 | static Image *get_paint_data_section(psiconv_paint_data_section sec) |
33 | static Image *get_paint_data_section(psiconv_paint_data_section sec) |
34 | { |
34 | { |
35 | Image *image; |
35 | Image *image; |
36 | image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green, |
36 | float *pixel, *p, *red, *green, *blue; |
37 | sec->blue,NULL); |
37 | int x,y; |
|
|
38 | ExceptionInfo *exc; |
|
|
39 | |
|
|
40 | GetExceptionInfo(exc); |
|
|
41 | red = sec->red; |
|
|
42 | green = sec->green; |
|
|
43 | blue = sec->blue; |
|
|
44 | p = pixel = malloc(sec->xsize * sec->ysize * 3 * sizeof(float)); |
|
|
45 | for (y = 0; y < sec->ysize; y++) { |
|
|
46 | for (x = 0; x < sec->xsize; x++) { |
|
|
47 | *p++ = *red++; |
|
|
48 | *p++ = *green++; |
|
|
49 | *p++ = *blue++; |
|
|
50 | } |
|
|
51 | } |
|
|
52 | image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,exc); |
|
|
53 | free(pixel); |
|
|
54 | DestroyExceptionInfo(exc); |
|
|
55 | |
38 | return image; |
56 | return image; |
39 | } |
57 | } |
40 | |
58 | |
|
|
59 | #endif |
41 | |
60 | |
42 | static int psiconv_gen_image_clipart(FILE *of, psiconv_clipart_f f, |
61 | static int psiconv_gen_image_clipart(FILE *of, psiconv_clipart_f f, |
43 | const char *dest) |
62 | const char *dest) |
44 | { |
63 | { |
45 | #if IMAGEMAGICK |
64 | #if IMAGEMAGICK |