summaryrefslogtreecommitdiff
path: root/converters/psiconv/patches/patch-ad
blob: f459eab0be11891212d5b7910a8ea6baf9ad6ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-ad,v 1.2 2000/08/30 16:13:13 sakamoto Exp $

--- psiconv/gen_image.c.orig	Sat Dec  4 09:46:15 1999
+++ psiconv/gen_image.c	Sat Jul  8 18:49:11 2000
@@ -33,8 +33,24 @@
 static Image *get_paint_data_section(psiconv_paint_data_section sec)
 {
   Image *image;
-  image = CreateImage(sec->xsize,sec->ysize,sec->red,sec->green,
-                             sec->blue,NULL);
+  float *pixel, *p, *red, *green, *blue;
+  int x,y;
+  ExceptionInfo exception;
+
+  red = sec->red;
+  green = sec->green;
+  blue = sec->blue;
+  p = pixel = malloc(sec->xsize * sec->ysize * 3 * sizeof(float));
+  for (y = 0; y < sec->ysize; y++) {
+    for (x = 0; x < sec->xsize; x++) {
+      *p++ = *red++;
+      *p++ = *green++;
+      *p++ = *blue++;
+    }
+  }
+  image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,&exception);
+  free(pixel);
+
   return image;
 }