From 916d5c9581117566441c20363e7e9db64888b0cf Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 16 Oct 2008 19:18:05 +0000 Subject: [PATCH] rename GVRENDER_NO_BG to GVRENDER_NO_WHITE_BG to better describe its purpose fix the logic in emit.c for bgcolor in -Tps --- lib/common/emit.c | 26 +++++++++++++++----------- lib/common/render.h | 1 - lib/gvc/gvcjob.h | 6 +++--- plugin/core/gvrender_core_ps.c | 2 +- plugin/core/gvrender_core_tk.c | 2 +- plugin/lasi/gvrender_lasi.cpp | 2 +- plugin/quartz/gvrender_quartz.c | 2 +- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 0ee93c34e..5e9046797 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -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) diff --git a/lib/common/render.h b/lib/common/render.h index c9ab524a8..dbecab292 100644 --- a/lib/common/render.h +++ b/lib/common/render.h @@ -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); */ diff --git a/lib/gvc/gvcjob.h b/lib/gvc/gvcjob.h index a4a60d8af..9f59ff0eb 100644 --- a/lib/gvc/gvcjob.h +++ b/lib/gvc/gvcjob.h @@ -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) diff --git a/plugin/core/gvrender_core_ps.c b/plugin/core/gvrender_core_ps.c index 07114f682..3c4a6e304 100644 --- a/plugin/core/gvrender_core_ps.c +++ b/plugin/core/gvrender_core_ps.c @@ -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 */ diff --git a/plugin/core/gvrender_core_tk.c b/plugin/core/gvrender_core_tk.c index ae8dd9303..9d355eca6 100644 --- a/plugin/core/gvrender_core_tk.c +++ b/plugin/core/gvrender_core_tk.c @@ -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 */ diff --git a/plugin/lasi/gvrender_lasi.cpp b/plugin/lasi/gvrender_lasi.cpp index 511357c90..a49a50eac 100644 --- a/plugin/lasi/gvrender_lasi.cpp +++ b/plugin/lasi/gvrender_lasi.cpp @@ -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 */ diff --git a/plugin/quartz/gvrender_quartz.c b/plugin/quartz/gvrender_quartz.c index 3151de02f..a60bfe033 100644 --- a/plugin/quartz/gvrender_quartz.c +++ b/plugin/quartz/gvrender_quartz.c @@ -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 */ -- 2.40.0