better resolution of exported graphs in ps/pdf and svg

This commit is contained in:
stefan schippers 2023-12-09 23:39:33 +01:00
parent 1285ba0cd4
commit 7a39f4d6ca
4 changed files with 16 additions and 11 deletions

View File

@ -3936,7 +3936,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
if(!has_x) return;
rw = fabs(rx2 -rx1);
rh = fabs(ry2 - ry1);
scale = 1.0;
scale = 3.0;
if(rw > rh && rw > max_size) {
scale = max_size / rw;
} else if(rh > max_size) {

View File

@ -95,7 +95,7 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i
cairo_surface_t* surface = NULL;
unsigned char* jpgData = NULL;
size_t fileSize = 0;
int quality=100;
int quality=40;
const char *quality_attr;
size_t image_data_len;
size_t oLength;
@ -244,7 +244,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
* static char str[PATH_MAX];
*/
unsigned char *ascii85EncodedJpeg;
int quality=100;
int quality=40;
const char *quality_attr;
size_t oLength;
int i;
@ -259,7 +259,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
if (!has_x) return;
rw = fabs(rx2 - rx1);
rh = fabs(ry2 - ry1);
scale = 2.0;
scale = 3.0;
if (rw > rh && rw > max_size) {
scale = max_size / rw;
}
@ -268,11 +268,12 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
}
rwi = (int)(rw * scale + 1.0);
rhi = (int)(rh * scale + 1.0);
dbg(1, "graph size: %dx%d\n", rwi, rhi);
save_restore_zoom(1);
set_viewport_size(rwi, rhi, xctx->lw);
zoom_box(rx1 - xctx->lw, ry1 - xctx->lw, rx2 + xctx->lw, ry2 + xctx->lw, 1.0);
resetwin(1, 1, 1, rwi, rhi);
change_linewidth(xctx->lw * 4.0);
change_linewidth(xctx->lw * 1.0);
dbg(1, "lw=%g\n", xctx->lw);
save_draw_grid = tclgetboolvar("draw_grid");
tclsetvar("draw_grid", "0");

View File

@ -86,7 +86,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), ""));
if(what & 1) flag = check_lib(2, abs_path); /* noprint_libs */
else flag = check_lib(4, abs_path); /* nolist_libs */
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && flag)
if(flag && (!strcmp(xctx->sym[i].type, "subcircuit") || !strcmp(xctx->sym[i].type, "primitive")))
{
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));
@ -96,13 +96,11 @@ void hier_psprint(char **res, int what) /* netlister driver */
const char *default_schematic;
/* do not insert symbols with default_schematic attribute set to ignore in hash since these symbols
* will not be processed by *_block_netlist() */
if(strcmp(get_tok_value(xctx->sym[i].prop_ptr, "default_schematic", 0), "ignore"))
str_hash_lookup(&subckt_table, subckt_name, "", XINSERT);
default_schematic = get_tok_value(xctx->sym[i].prop_ptr, "default_schematic", 0);
if(!strcmp(default_schematic, "ignore")) {
continue;
}
str_hash_lookup(&subckt_table, subckt_name, "", XINSERT);
if(is_generator(filename) || !stat(filename, &buf)) {
/* for printing we go down to bottom regardless of spice_stop attribute */
@ -582,8 +580,10 @@ int spice_block_netlist(FILE *fd, int i)
spice_stop=1;
else
spice_stop=0;
if(!strcmp(get_tok_value(xctx->sym[i].prop_ptr, "format", 0), "")) {
return err;
}
get_sch_from_sym(filename, xctx->sym + i, -1);
default_schematic = get_tok_value(xctx->sym[i].prop_ptr, "default_schematic", 0);
if(!strcmp(default_schematic, "ignore")) {
return err;

View File

@ -2363,7 +2363,11 @@ proc graph_set_linewidth {graph_sel} {
set custom_lw $graph_linewidth_mult
}
graph_push_undo
xschem setprop rect 2 $graph_sel linewidth_mult $custom_lw
if {$custom_lw != $graph_linewidth_mult} {
xschem setprop rect 2 $graph_sel linewidth_mult $custom_lw
} else {
xschem setprop rect 2 $graph_sel linewidth_mult ;# delete attribute since it is default
}
}
proc graph_edit_properties {n} {