groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] color fill patches for grops


From: Gaius Mulley
Subject: [Groff] color fill patches for grops
Date: Tue, 15 Jan 2002 08:32:17 +0000

Hi Werner,

I think this patch fixes the color fill problems in grops.

Gaius

ps. many thanks to all the people who have supplied color tests.

--- groff-cvs/src/devices/grops/ps.cc   Fri Oct  5 15:12:17 2001
+++ groff-html/src/devices/grops/ps.cc  Mon Jan 14 23:32:11 2002
@@ -922,22 +922,31 @@
 
 void ps_printer::fill_path()
 {
-  double c, m, y, k;
-  fill_color->get_cmyk(&c, &m, &y, &k);
+  double k;
+
   if (fill_color->is_gray()) {
-    if (k == 1.0)
-      out.put_symbol("BL");    
-    else
-      out.put_float(1.0-k)
-        .put_symbol("FL");
+    // gray shade is a special case
+    fill_color->get_gray(&k);
+    output_color = fill_color;
+     
+    out.put_float(1.0-k)
+      .put_symbol("FL");
   }
+  else if (fill_color->is_equal(output_color))
+    /*
+     * ahh, the penny has dropped:
+     *
+     * fill using current color (BL does not mean black now..
+     * interestingly it did pre color (there used to be a test
+     * for grayscale = 1.0). The 'BL' function fills according
+     * to the previous color which (of course pre color
+     * would always be black).
+     */
+    out.put_symbol("BL");
+
   else {
-    if (output_color->is_equal(fill_color))
-      out.put_symbol("fill");
-    else {
-      set_color(fill_color, 0);
-      out.put_symbol("FC");
-    }
+    set_color(fill_color, 0);
+    out.put_symbol("FC");
   }
 }
 
@@ -1117,7 +1126,7 @@
     break;
   case 'F':
     // fill with color env->fill
-    *fill_color = *env->fill;
+    fill_color = env->fill;
     break;
   default:
     error("unrecognised drawing command `%1'", char(code));

reply via email to

[Prev in Thread] Current Thread [Next in Thread]