Hello,

The braille coder wasn't handling the DirectClass image case, leading to
a crash, here is a patch to fix it.

Samuel
--- coders/braille.c.backup     2009-10-23 14:07:36.000000000 +0200
+++ coders/braille.c    2009-10-23 15:47:55.000000000 +0200
@@ -247,12 +247,15 @@
     }
 
   (void) SetImageType(image,BilevelType);
-  polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >=
-    (Quantum) (QuantumRange/2));
-  if (image->colors == 2)
-    polarity=(IndexPacket)
-      (PixelIntensityToQuantum(&image->colormap[0]) >=
-       PixelIntensityToQuantum(&image->colormap[1]));
+  if (image->storage_class == PseudoClass) {
+    polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >=
+      (Quantum) (QuantumRange/2));
+    if (image->colors == 2)
+      polarity=(IndexPacket)
+        (PixelIntensityToQuantum(&image->colormap[0]) >=
+         PixelIntensityToQuantum(&image->colormap[1]));
+    polarity = 0;
+  }
   for (y=0; y < (long) image->rows; y+=cell_height)
   {
     if ((y+cell_height) > image->rows)
@@ -270,8 +273,12 @@
 
       do
       {
-#define do_cell(dx,dy,bit) \
-        cell |= (indexes[x+dx+dy*image->columns]==polarity)<<bit;
+#define do_cell(dx,dy,bit) do { \
+        if (image->storage_class == PseudoClass) \
+          cell |= (indexes[x+dx+dy*image->columns] == polarity) << bit; \
+        else \
+          cell |= (p[x+dx+dy*image->columns].green == 0) << bit; \
+} while (0) 
 
         do_cell(0,0,0);
         if (two_columns)
_______________________________________________
Magick-developers mailing list
Magick-developers@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-developers

Reply via email to