Compare commits
2 Commits
27cb06afe2
...
d1a1cb762a
Author | SHA1 | Date | |
---|---|---|---|
d1a1cb762a | |||
223a2c6e71 |
@ -70,7 +70,7 @@ static gboolean write_layer_env(FILE *tex_file, GdkRGBA *color, int layer, GList
|
||||
color->red = inf->color.red;
|
||||
color->green = inf->color.green;
|
||||
color->blue = inf->color.blue;
|
||||
g_string_printf(buffer, "\\begin{pgfonlayer}{l%d}\n\\begin{scope}[ocg={ref=%d, status=visible,name={%s}}]\n",
|
||||
g_string_printf(buffer, "\\begin{pgfonlayer}{l%d}\n\\ifcreatepdflayers\n\\begin{scope}[ocg={ref=%d, status=visible,name={%s}}]\n\\fi]\n",
|
||||
layer, layer, inf->name);
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
return TRUE;
|
||||
@ -96,8 +96,6 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
||||
|
||||
/* Layer is defined => create graphics */
|
||||
if (gfx->type == GRAPHIC_POLYGON) {
|
||||
|
||||
|
||||
g_string_printf(buffer, "\\draw[line width=0.00001 pt, draw={c%d}, fill={c%d}, fill opacity={%lf}] ",
|
||||
gfx->layer, gfx->layer, color.alpha);
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
@ -109,9 +107,24 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
||||
}
|
||||
g_string_printf(buffer, "cycle;\n");
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
} else if(gfx->type == GRAPHIC_PATH) {
|
||||
g_string_printf(buffer, "\\draw[line width=%lf pt, draw={c%d}, opacity={%lf}] ",
|
||||
gfx->width_absolute/1000.0, gfx->layer, gfx->layer, color.alpha);
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
/* Append vertices */
|
||||
for (temp_vertex = gfx->vertices; temp_vertex != NULL; temp_vertex = temp_vertex->next) {
|
||||
pt = (struct gds_point *)temp_vertex->data;
|
||||
g_string_printf(buffer, "(%lf pt, %lf pt)%s",
|
||||
((double)pt->x)/1000.0,
|
||||
((double)pt->y)/1000.0,
|
||||
(temp_vertex->next ? " -- " : ""));
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
}
|
||||
g_string_printf(buffer, ";\n");
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
}
|
||||
|
||||
g_string_printf(buffer, "\\end{scope}\n\\end{pgfonlayer}\n");
|
||||
g_string_printf(buffer, "\\ifcreatepdflayers\n\\end{scope}\n\\fi\n\\end{pgfonlayer}\n");
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
}
|
||||
|
||||
@ -167,6 +180,8 @@ void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_fi
|
||||
/* standalone foo */
|
||||
g_string_printf(working_line, "\\newif\\iftestmode\n\\testmodefalse %% Change to true for standalone rendering\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\newif\\ifcreatepdflayers\n\\createpdflayersfalse %% Change to true for Embedded layers in PDF output\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\iftestmode\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\documentclass[tikz]{standalone}\n\\usepackage{xcolor}\n\\usetikzlibrary{ocgx}\n\\begin{document}\n");
|
||||
|
BIN
test-data/path.gds
Normal file
BIN
test-data/path.gds
Normal file
Binary file not shown.
BIN
test-data/path.pdf
Normal file
BIN
test-data/path.pdf
Normal file
Binary file not shown.
38
test-data/path.tex
Normal file
38
test-data/path.tex
Normal file
@ -0,0 +1,38 @@
|
||||
\newif\iftestmode
|
||||
\testmodetrue % Change to true for standalone rendering
|
||||
\newif\ifcreatepdflayers
|
||||
\createpdflayerstrue % Change to true for Embedded layers in PDF output
|
||||
\iftestmode
|
||||
\documentclass[tikz]{standalone}
|
||||
\usepackage{xcolor}
|
||||
\usetikzlibrary{ocgx}
|
||||
\begin{document}
|
||||
\fi
|
||||
\pgfdeclarelayer{l2}
|
||||
\definecolor{c2}{rgb}{0.203922,0.396078,0.643137}
|
||||
\pgfdeclarelayer{l1}
|
||||
\definecolor{c1}{rgb}{0.450980,0.823529,0.086275}
|
||||
\pgfsetlayers{l2,l1,main}
|
||||
\begin{tikzpicture}
|
||||
\begin{pgfonlayer}{l1}
|
||||
\ifcreatepdflayers
|
||||
\begin{scope}[ocg={ref=1, status=visible,name={TOP-Layer}}]
|
||||
\fi]
|
||||
\draw[line width=0.300000 pt, draw={c1}, opacity={1.000000}] (-1.218000 pt, 0.711000 pt) -- (-0.197000 pt, 0.425000 pt) -- (-0.027000 pt, -0.046000 pt) -- (0.919000 pt, -0.304000 pt);
|
||||
\ifcreatepdflayers
|
||||
\end{scope}
|
||||
\fi
|
||||
\end{pgfonlayer}
|
||||
\begin{pgfonlayer}{l2}
|
||||
\ifcreatepdflayers
|
||||
\begin{scope}[ocg={ref=2, status=visible,name={BOTTOM-Layer}}]
|
||||
\fi]
|
||||
\draw[line width=0.00001 pt, draw={c2}, fill={c2}, fill opacity={1.000000}] (-1.264000 pt, -0.471000 pt) -- (-1.264000 pt, 0.768000 pt) -- (1.047000 pt, 0.768000 pt) -- (1.047000 pt, -0.471000 pt) -- (-1.264000 pt, -0.471000 pt) -- cycle;
|
||||
\ifcreatepdflayers
|
||||
\end{scope}
|
||||
\fi
|
||||
\end{pgfonlayer}
|
||||
\end{tikzpicture}
|
||||
\iftestmode
|
||||
\end{document}
|
||||
\fi
|
Binary file not shown.
7206
test-data/test.tex
7206
test-data/test.tex
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user