]> granicus.if.org Git - graphviz/commitdiff
rename GVRENDER_NO_BG to GVRENDER_NO_WHITE_BG to better describe its purpose
authorellson <devnull@localhost>
Thu, 16 Oct 2008 19:18:05 +0000 (19:18 +0000)
committerellson <devnull@localhost>
Thu, 16 Oct 2008 19:18:05 +0000 (19:18 +0000)
fix the logic in emit.c for bgcolor in -Tps

lib/common/emit.c
lib/common/render.h
lib/gvc/gvcjob.h
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_tk.c
plugin/lasi/gvrender_lasi.cpp
plugin/quartz/gvrender_quartz.c

index 0ee93c34ef1e0c1d97a1f8210bae05ea13a4d769..5e9046797aecc214e986c95c3d1581565f3a08b9 100644 (file)
@@ -817,21 +817,25 @@ static boolean write_node_test(Agraph_t * g, Agnode_t * n)
     return TRUE;
 }
 
-void emit_background(GVJ_t * job, graph_t *g)
+static void emit_background(GVJ_t * job, graph_t *g)
 {
     char *str;
     
-    if (! ((str = agget(g, "bgcolor")) && str[0])) {
-       if (job->flags & GVRENDER_NO_BG)
-           str = "transparent";
-       else
-           str = "white";
-    }
-
-    gvrender_set_fillcolor(job, str);
-    gvrender_set_pencolor(job, str);
-    if (!(job->flags & GVRENDER_NO_BG))
+    /* if no bgcolor specified - first assume default of "transparent" */
+    if (! ((str = agget(g, "bgcolor")) && str[0]))
+       str = "transparent";
+
+    /* if device has no truecolor support, change "transparent" (default or given) to "white" */
+    if (! (job->flags & GVDEVICE_DOES_TRUECOLOR) && (streq(str, "transparent")))
+       str = "white";
+
+    /* except for "tranparent" on truecolor, or "white" on (assumed) white paper, paint background */
+    if (!(   ((job->flags & GVDEVICE_DOES_TRUECOLOR) && streq(str, "transparent"))
+          || ((job->flags & GVRENDER_NO_WHITE_BG) && streq(str, "white")))) {
+        gvrender_set_fillcolor(job, str);
+        gvrender_set_pencolor(job, str);
         gvrender_box(job, job->clip, TRUE);    /* filled */
+    }
 }
 
 static void setup_page(GVJ_t * job, graph_t * g)
index c9ab524a8f2f40d007b9fb26a552b80a50e246f8..dbecab292cf113465fe457b36a6410f8447ce330 100644 (file)
@@ -91,7 +91,6 @@ extern "C" {
     extern void dotneato_write(GVC_t * gvc, graph_t *g);
     extern void dotneato_write_one(GVC_t * gvc, graph_t *g);
     extern double elapsed_sec(void);
-    extern void emit_background(GVJ_t * job, graph_t *g);
     extern void emit_clusters(GVJ_t * job, Agraph_t * g, int flags);
     /* extern void emit_begin_edge(GVJ_t * job, edge_t * e, char**); */
     /* extern void emit_end_edge(GVJ_t * job); */
index a4a60d8af15672ce3c610430fdb59a6c4b1ceb52..9f59ff0eb8981145a24dfe2b9af0d25cc38275e1 100644 (file)
@@ -55,7 +55,7 @@ extern "C" {
  GVDEVICE_DOES_PAGES           provides pagination support -Tps        
  GVDEVICE_DOES_LAYERS          provides support for layers -Tps        
  GVDEVICE_EVENTS               supports mouse events -Tgtk, -Txlib     
- GVDEVICE_DOES_TRUECOLOR       supports alph channel -Tpng, -Tgtk, -Txlib 
+ GVDEVICE_DOES_TRUECOLOR       supports alpha channel -Tpng, -Tgtk, -Txlib 
  GVDEVICE_BINARY_FORMAT                Suppresses \r\n substitution for linends 
  GVDEVICE_COMPRESSED_FORMAT    controls libz compression               
  GVDEVICE_NO_WRITER            used when gvdevice is not used because device uses its own writer, -Tming, devil outputs   (FIXME seems to overlap OUTPUT_NOT_REQUIRED)
@@ -76,7 +76,7 @@ extern "C" {
  GVRENDER_DOES_TOOLTIPS                can represent tooltip info -Tcmapx, -Tsvg               
  GVRENDER_DOES_TARGETS         can represent target info (open link in a new tab or window) 
  GVRENDER_DOES_Z               render support 2.5D representation -Tvrml 
- GVRENDER_NO_BG                        don't paint white background, assumes white paper -Tps 
+ GVRENDER_NO_WHITE_BG          don't paint white background, assumes white paper -Tps 
  LAYOUT_NOT_REQUIRED           don't perform layout -Tcanon            
  OUTPUT_NOT_REQUIRED           don't use gvdevice for output (basically when agwrite() used instead) -Tcanon, -Txdot 
  */
@@ -107,7 +107,7 @@ extern "C" {
 #define GVRENDER_DOES_TOOLTIPS (1<<22)
 #define GVRENDER_DOES_TARGETS (1<<23)
 #define GVRENDER_DOES_Z (1<<24)
-#define GVRENDER_NO_BG (1<<25)
+#define GVRENDER_NO_WHITE_BG (1<<25)
 #define LAYOUT_NOT_REQUIRED (1<<26)
 #define OUTPUT_NOT_REQUIRED (1<<27)
 
index 07114f682d23c3e0dd8376487e737d8b1954d1b2..3c4a6e304d848b8f8b5337a5d0a369ff646ee0f1 100644 (file)
@@ -467,7 +467,7 @@ static gvrender_engine_t psgen_engine = {
 static gvrender_features_t render_features_ps = {
     GVRENDER_DOES_TRANSFORM
        | GVRENDER_DOES_MAPS
-       | GVRENDER_NO_BG
+       | GVRENDER_NO_WHITE_BG
        | GVRENDER_DOES_MAP_RECTANGLE,
     4.,                         /* default pad - graph units */
     NULL,                      /* knowncolors */
index ae8dd93032b0d98e601257348601e66cdf133c9e..9d355eca6f79ef6c49786a04f8c39c33a67f9c59 100644 (file)
@@ -341,7 +341,7 @@ gvrender_engine_t tkgen_engine = {
 
 gvrender_features_t render_features_tk = {
     GVRENDER_Y_GOES_DOWN
-       | GVRENDER_NO_BG, /* flags */
+       | GVRENDER_NO_WHITE_BG, /* flags */
     4.,                         /* default pad - graph units */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 511357c90255c62ede36bee6297538d9799e1681..a49a50eace956a78acc262089ccc59eb36e0776f 100644 (file)
@@ -543,7 +543,7 @@ static gvrender_engine_t lasi_engine = {
 static gvrender_features_t render_features_lasi = {
     GVRENDER_DOES_TRANSFORM
        | GVRENDER_DOES_MAPS
-       | GVRENDER_NO_BG
+       | GVRENDER_NO_WHITE_BG
        | GVRENDER_DOES_MAP_RECTANGLE,
     4.,                         /* default pad - graph units */
     NULL,                      /* knowncolors */
index 3151de02f04b4d0c2ac319be2b912af59b3f5b7d..a60bfe0334f462eca9203d1d5dd59d66596a65e3 100644 (file)
@@ -377,7 +377,7 @@ static gvdevice_features_t device_features_quartz_paged = {
        GVDEVICE_DOES_PAGES
          | GVDEVICE_BINARY_FORMAT
       | GVDEVICE_DOES_TRUECOLOR
-         | GVRENDER_NO_BG,                     /* flags */
+         | GVRENDER_NO_WHITE_BG,                       /* flags */
     {36.,36.},                    /* default margin - points */
     {0.,0.},                    /* default page width, height - points */
     {72.,72.}                  /* dpi */