From 11b6231ba5d037d6f68bafaed9b57abb420511f0 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Thu, 13 Jul 2023 17:47:43 +0800 Subject: [PATCH] draw Diode --- ses_layout.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 474ef09..1ba003a 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -686,21 +686,22 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ p = c->pins[SCF_EDA_Diode_POS]; vertical(&dx0, &dy0, c->x - p->x, c->y - p->y, 6); - vertical(&dx1, &dy1, c->x - p->x, c->y - p->y, -6); - vertical(&dx2, &dy2, c->x - p->x, c->y - p->y, -12); - forward (&dx3, &dy3, c->x - p->x, c->y - p->y, 12); + forward (&dx1, &dy1, c->x - p->x, c->y - p->y, 6); - cairo_move_to(cr, p->x, p->y); - cairo_line_to(cr, c->x, c->y); + cairo_move_to(cr, p->x, p->y); + cairo_line_to(cr, c->x - dx1, c->y - dy1); - cairo_rel_move_to(cr, dx0, dy0); - cairo_rel_line_to(cr, dx2, dy2); - cairo_line_to (cr, c->x + dx3, c->y + dy3); - cairo_line_to (cr, c->x + dx0, c->y + dy0); + cairo_rel_move_to(cr, dx0, dy0); + cairo_rel_line_to(cr, -dx0 * 2, -dy0 * 2); + cairo_line_to (cr, c->x + dx1, c->y + dy1); + cairo_line_to (cr, c->x + dx0 - dx1, c->y + dy0 - dy1); p = c->pins[SCF_EDA_Diode_NEG]; - cairo_move_to(cr, c->x + dx3, c->y + dy3); - cairo_line_to(cr, p->x, p->y); + + cairo_move_to (cr, p->x, p->y); + cairo_line_to (cr, c->x + dx1, c->y + dy1); + cairo_rel_move_to(cr, dx0, dy0); + cairo_rel_line_to(cr, -dx0 * 2, -dy0 * 2); break; case SCF_EDA_Transistor: -- 2.25.1