mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-27 01:15:00 +02:00
sch2fig/: support circles
This commit is contained in:
parent
9618846d46
commit
c979bf0989
@ -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)
|
||||
{
|
||||
#if 0
|
||||
// Type Thick Depth StyleV Cx Rx Sx Ex
|
||||
// SubTy Color Pen Dir Cy Ry Sy Ey
|
||||
// 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",
|
||||
COLOR_WIRE, LAYER_WIRES, cx(x), cy(y), JUNCTION_R, JUNCTION_R,
|
||||
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,
|
||||
enum text_align align, int rot, unsigned color, unsigned layer)
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ void fig_rect(int sx, int sy, int ex, int ey,
|
||||
int color, int fill_color, unsigned layer);
|
||||
void fig_poly(int points, int x[points], int y[points],
|
||||
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,
|
||||
enum text_align align, int rot, unsigned color, unsigned layer);
|
||||
|
||||
|
@ -53,7 +53,7 @@ struct obj {
|
||||
int sx, sy;
|
||||
int ex, ey;
|
||||
} rect;
|
||||
struct {
|
||||
struct circ_obj {
|
||||
int x, y;
|
||||
int r;
|
||||
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,
|
||||
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);
|
||||
break;
|
||||
case obj_circ:
|
||||
unsupported("circle");
|
||||
draw_circ(&obj->u.circ, m);
|
||||
break;
|
||||
case obj_arc:
|
||||
unsupported("arc");
|
||||
|
Loading…
Reference in New Issue
Block a user