Added a "plot svg" command that, when used in conjuction with the

Cairo graphics package (magic -d XR), will map the display onto
an SVG surface and save it to a file using the Cairo SVG backend.
Due to the simplicity of the mapping, there are no options to this
plot command;  it just creates a file that is a (scalable!)
replica of the layout window.
This commit is contained in:
Tim Edwards
2019-03-12 13:29:24 -04:00
parent c08ddd355f
commit 1f3a512909
2 changed files with 65 additions and 1 deletions
+26 -1
View File
@@ -67,6 +67,9 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
typedef enum {
POSTSCRIPT=0,
PLOTPNM,
#ifdef HAVE_LIBCAIRO
PLOTSVG,
#endif
#ifdef GREMLIN
STYLE_GREMLIN,
#endif
@@ -94,12 +97,19 @@ CmdPlot(w, cmd)
float width;
int iwidth, scale;
#ifdef HAVE_LIBCAIRO
extern void GrTCairoPlotSVG();
#endif
static char *cmdPlotOption[] =
{
"postscript file [layers] generate PostScript file for what's\n\
underneath the box",
"pnm file [width [layers]] generate PNM file for what's\n\
underneath the box",
#ifdef HAVE_LIBCAIRO
"svg file generate SVG file for the whole window",
#endif
#ifdef GREMLIN
"gremlin file [layers] generate gremlin file for what's\n\
underneath the box",
@@ -138,6 +148,9 @@ CmdPlot(w, cmd)
#ifdef GREMLIN
|| (option == STYLE_GREMLIN)
#endif
#ifdef HAVE_LIBCAIRO
|| (option == PLOTSVG)
#endif
#ifdef VERSATEC
|| (option == STYLE_VERSATEC)
#endif
@@ -192,7 +205,7 @@ CmdPlot(w, cmd)
}
PlotPS(cmd->tx_argv[2], &scx, &mask, crec->dbw_bitmask);
return;
#ifdef GREMLIN
case STYLE_GREMLIN:
if ((cmd->tx_argc != 3) && (cmd->tx_argc != 4))
@@ -250,6 +263,18 @@ CmdPlot(w, cmd)
return;
#endif
#ifdef HAVE_LIBCAIRO
case PLOTSVG:
if (cmd->tx_argc > 3)
{
TxError("Too many arguments:\n plot %s\n",
cmdPlotOption[PLOTSVG]);
return;
}
GrTCairoPlotSVG(cmd->tx_argv[2], window);
return;
#endif
case PLOTPNM:
if (cmd->tx_argc > 5)
{