1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-27 01:59:42 +02:00

sch2fig/: support circles

This commit is contained in:
Werner Almesberger 2016-07-25 00:50:48 -03:00
parent 9618846d46
commit c979bf0989
3 changed files with 44 additions and 2 deletions

View File

@ -223,12 +223,15 @@ void fig_glabel(int x, int y, const char *s, int dir, int dim,
void fig_junction(int x, int y) void fig_junction(int x, int y)
{ {
#if 0
// Type Thick Depth StyleV Cx Rx Sx Ex // Type Thick Depth StyleV Cx Rx Sx Ex
// SubTy Color Pen Dir Cy Ry Sy Ey // SubTy Color Pen Dir Cy Ry Sy Ey
// Style FillCol AreaFil Angle // Style FillCol AreaFil Angle
printf("1 3 0 0 -1 %d %d -1 20 0.0 1 0.0 %d %d %d %d %d %d %d %d\n", printf("1 3 0 0 -1 %d %d -1 20 0.0 1 0.0 %d %d %d %d %d %d %d %d\n",
COLOR_WIRE, LAYER_WIRES, cx(x), cy(y), JUNCTION_R, JUNCTION_R, COLOR_WIRE, LAYER_WIRES, cx(x), cy(y), JUNCTION_R, JUNCTION_R,
cx(x), cy(y), cx(x) + JUNCTION_R, cy(y)); cx(x), cy(y), cx(x) + JUNCTION_R, cy(y));
#endif
fig_circ(x, y, JUNCTION_R, COLOR_NONE, COLOR_WIRE, LAYER_WIRES);
} }
@ -303,6 +306,19 @@ void fig_poly(int points, int x[points], int y[points],
} }
void fig_circ(int x, int y, int r, int color, int fill_color, unsigned layer)
{
// Type Thick Depth StyleV Cx Rx Sx Ex
// SubTy Color Pen Dir Cy Ry Sy Ey
// Style FillCol AreaFil Angle
printf("1 3 0 %d %d %d %d -1 %d 0.0 1 0.0 %d %d %d %d %d %d %d %d\n",
color == -1 ? 0 : WIDTH_COMP_DWG, color, fill_color, layer,
fill_color == -1 ? -1 : 20,
cx(x), cy(y), r, r,
cx(x), cy(y), cx(x) + r, cy(y));
}
void fig_text(int x, int y, const char *s, unsigned size, void fig_text(int x, int y, const char *s, unsigned size,
enum text_align align, int rot, unsigned color, unsigned layer) enum text_align align, int rot, unsigned color, unsigned layer)
{ {

View File

@ -45,6 +45,7 @@ void fig_rect(int sx, int sy, int ex, int ey,
int color, int fill_color, unsigned layer); int color, int fill_color, unsigned layer);
void fig_poly(int points, int x[points], int y[points], void fig_poly(int points, int x[points], int y[points],
int color, int fill_color, unsigned layer); int color, int fill_color, unsigned layer);
void fig_circ(int x, int y, int r, int color, int fill_color, unsigned layer);
void fig_text(int x, int y, const char *s, unsigned size, void fig_text(int x, int y, const char *s, unsigned size,
enum text_align align, int rot, unsigned color, unsigned layer); enum text_align align, int rot, unsigned color, unsigned layer);

View File

@ -53,7 +53,7 @@ struct obj {
int sx, sy; int sx, sy;
int ex, ey; int ex, ey;
} rect; } rect;
struct { struct circ_obj {
int x, y; int x, y;
int r; int r;
int thick; int thick;
@ -163,6 +163,31 @@ static void draw_rect(const struct rect_obj *rect, int m[6])
} }
static void draw_circ(const struct circ_obj *circ, int m[6])
{
int x = mx(circ->x, circ->y, m);
int y = my(circ->x, circ->y, m);
int r = circ->r;
fig_circ(x, y, r, COLOR_COMP_DWG, COLOR_NONE, LAYER_COMP_DWG);
switch (circ->fill) {
case 'N':
break;
case 'F':
fig_circ(x, y, r, COLOR_NONE, COLOR_COMP_DWG,
LAYER_COMP_DWG_BG);
break;
case 'f':
fig_circ(x, y, r, COLOR_NONE, COLOR_COMP_DWG_BG,
LAYER_COMP_DWG_BG);
break;
default:
abort();
}
}
static void draw_pin(const struct comp *comp, const struct pin_obj *pin, static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
int m[6]) int m[6])
{ {
@ -279,7 +304,7 @@ static void draw(const struct comp *comp, const struct obj *obj, int m[6])
draw_rect(&obj->u.rect, m); draw_rect(&obj->u.rect, m);
break; break;
case obj_circ: case obj_circ:
unsupported("circle"); draw_circ(&obj->u.circ, m);
break; break;
case obj_arc: case obj_arc:
unsupported("arc"); unsupported("arc");