Index: trunk/src_plugins/export_dxf/dxf.c =================================================================== --- trunk/src_plugins/export_dxf/dxf.c (revision 12273) +++ trunk/src_plugins/export_dxf/dxf.c (revision 12274) @@ -503,6 +503,7 @@ dxf_hid.draw_rect = dxf_draw_rect; dxf_hid.fill_circle = dxf_fill_circle; dxf_hid.fill_polygon = dxf_fill_polygon; + dxf_hid.fill_polygon_offs = dxf_fill_polygon_offs; dxf_hid.fill_rect = dxf_fill_rect; dxf_hid.calibrate = dxf_calibrate; dxf_hid.set_crosshair = dxf_set_crosshair; Index: trunk/src_plugins/export_dxf/dxf_draw.c =================================================================== --- trunk/src_plugins/export_dxf/dxf_draw.c (revision 12273) +++ trunk/src_plugins/export_dxf/dxf_draw.c (revision 12274) @@ -146,7 +146,7 @@ fprintf(ctx->f, "51\n%f\n", end_angle); } -static void dxf_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +static void dxf_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { dxf_ctx_t *ctx = &dxf_ctx; int n, to; @@ -153,13 +153,13 @@ #if HATCH_NEEDS_BBOX pcb_coord_t x_min, x_max, y_min, y_max; - x_max = x_min = *x; - y_max = y_min = *y; + x_max = x_min = *x + dx; + y_max = y_min = *y + dy; for(n = 1; n < n_coords; n++) { - if (x[n] < x_min) x_min = x[n]; - if (x[n] > x_max) x_max = x[n]; - if (y[n] < y_min) y_min = y[n]; - if (y[n] > y_max) y_max = y[n]; + if (x[n] < x_min) x_min = x[n] + dx; + if (x[n] > x_max) x_max = x[n] + dx; + if (y[n] < y_min) y_min = y[n] + dy; + if (y[n] > y_max) y_max = y[n] + dy; } #endif @@ -170,8 +170,8 @@ if (to == n_coords) to = 0; fprintf(ctx->f, "72\n1\n"); /* edge=line */ - pcb_fprintf(ctx->f, "10\n%mm\n20\n%mm\n", TRX(x[n]), TRY(y[n])); - pcb_fprintf(ctx->f, "11\n%mm\n21\n%mm\n", TRX(x[to]), TRY(y[to])); + pcb_fprintf(ctx->f, "10\n%mm\n20\n%mm\n", TRX(x[n]+dx), TRY(y[n]+dy)); + pcb_fprintf(ctx->f, "11\n%mm\n21\n%mm\n", TRX(x[to]+dx), TRY(y[to]+dy)); } dxf_hatch_post(ctx); } @@ -181,11 +181,17 @@ to = n+1; if (to == n_coords) to = 0; - dxf_draw_line(&thin, x[n], y[n], x[to], y[to]); + dxf_draw_line(&thin, x[n]+dx, y[n]+dy, x[to]+dx, y[to]+dy); } } } + +static void dxf_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + dxf_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + static void dxf_gen_layer(dxf_ctx_t *ctx, const char *name) { fprintf(ctx->f, "0\nLAYER\n"); Index: trunk/src_plugins/export_gcode/gcode.c =================================================================== --- trunk/src_plugins/export_gcode/gcode.c (revision 12273) +++ trunk/src_plugins/export_gcode/gcode.c (revision 12274) @@ -830,7 +830,7 @@ } } -static void gcode_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void gcode_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int i; gdPoint *points; @@ -842,8 +842,8 @@ } use_gc(gc); for (i = 0; i < n_coords; i++) { - points[i].x = pcb_to_gcode(x[i]); - points[i].y = pcb_to_gcode(y[i]); + points[i].x = pcb_to_gcode(x[i] + dx); + points[i].y = pcb_to_gcode(y[i] + dy); } gdImageSetThickness(gcode_im, 0); linewidth = 0; @@ -852,6 +852,12 @@ /* printf("FillPoly\n"); */ } +static void gcode_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + gcode_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + static void gcode_calibrate(double xval, double yval) { CRASH("gcode_calibrate"); @@ -909,6 +915,7 @@ gcode_hid.draw_rect = gcode_draw_rect; gcode_hid.fill_circle = gcode_fill_circle; gcode_hid.fill_polygon = gcode_fill_polygon; + gcode_hid.fill_polygon_offs = gcode_fill_polygon_offs; gcode_hid.fill_rect = gcode_fill_rect; gcode_hid.calibrate = gcode_calibrate; gcode_hid.set_crosshair = gcode_set_crosshair; Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 12273) +++ trunk/src_plugins/export_gerber/gerber.c (revision 12274) @@ -58,6 +58,7 @@ static void gerber_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2); static void gerber_calibrate(double xval, double yval); static void gerber_set_crosshair(int x, int y, int action); +static void gerber_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy); static void gerber_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y); /*----------------------------------------------------------------------------*/ @@ -1202,7 +1203,7 @@ fprintf(f, "D03*\r\n"); } -static void gerber_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void gerber_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { pcb_bool m = pcb_false; int i; @@ -1217,20 +1218,20 @@ return; fprintf(f, "G36*\r\n"); for (i = 0; i < n_coords; i++) { - if (x[i] != lastX) { + if (x[i]+dx != lastX) { m = pcb_true; - lastX = x[i]; + lastX = x[i]+dx; pcb_fprintf(f, "X%.0mc", gerberX(PCB, lastX)); } - if (y[i] != lastY) { + if (y[i]+dy != lastY) { m = pcb_true; - lastY = y[i]; + lastY = y[i]+dy; pcb_fprintf(f, "Y%.0mc", gerberY(PCB, lastY)); } if (firstTime) { firstTime = 0; - startX = x[i]; - startY = y[i]; + startX = x[i]+dx; + startY = y[i]+dy; if (m) fprintf(f, "D02*"); } @@ -1253,6 +1254,12 @@ fprintf(f, "G37*\r\n"); } +static void gerber_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + gerber_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + static void gerber_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) { pcb_coord_t x[5]; @@ -1322,6 +1329,7 @@ gerber_hid.draw_rect = gerber_draw_rect; gerber_hid.fill_circle = gerber_fill_circle; gerber_hid.fill_polygon = gerber_fill_polygon; + gerber_hid.fill_polygon_offs = gerber_fill_polygon_offs; gerber_hid.fill_rect = gerber_fill_rect; gerber_hid.calibrate = gerber_calibrate; gerber_hid.set_crosshair = gerber_set_crosshair; Index: trunk/src_plugins/export_nelma/nelma.c =================================================================== --- trunk/src_plugins/export_nelma/nelma.c (revision 12273) +++ trunk/src_plugins/export_nelma/nelma.c (revision 12274) @@ -917,7 +917,7 @@ } -static void nelma_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void nelma_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int i; gdPoint *points; @@ -929,8 +929,8 @@ } use_gc(gc); for (i = 0; i < n_coords; i++) { - points[i].x = pcb_to_nelma(x[i]); - points[i].y = pcb_to_nelma(y[i]); + points[i].x = pcb_to_nelma(x[i]+dx); + points[i].y = pcb_to_nelma(y[i]+dy); } gdImageSetThickness(nelma_im, 0); linewidth = 0; @@ -938,6 +938,12 @@ free(points); } +static void nelma_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + nelma_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + static void nelma_calibrate(double xval, double yval) { CRASH("nelma_calibrate"); @@ -995,6 +1001,7 @@ nelma_hid.draw_rect = nelma_draw_rect; nelma_hid.fill_circle = nelma_fill_circle; nelma_hid.fill_polygon = nelma_fill_polygon; + nelma_hid.fill_polygon_offs = nelma_fill_polygon_offs; nelma_hid.fill_rect = nelma_fill_rect; nelma_hid.calibrate = nelma_calibrate; nelma_hid.set_crosshair = nelma_set_crosshair; Index: trunk/src_plugins/export_openscad/export_openscad.c =================================================================== --- trunk/src_plugins/export_openscad/export_openscad.c (revision 12273) +++ trunk/src_plugins/export_openscad/export_openscad.c (revision 12274) @@ -555,15 +555,20 @@ pcb_fprintf(f, " pcb_fcirc(%mm, %mm, %mm, %f);\n", cx, cy, radius, effective_layer_thickness); } -static void openscad_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void openscad_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int n; fprintf(f, " pcb_fill_poly(["); for(n = 0; n < n_coords-1; n++) - pcb_fprintf(f, "[%mm,%mm],", TRX_(x[n]), TRY_(y[n])); - pcb_fprintf(f, "[%mm,%mm]], %f);\n", TRX_(x[n]), TRY_(y[n]), effective_layer_thickness); + pcb_fprintf(f, "[%mm,%mm],", TRX_(x[n]+dx), TRY_(y[n]+dy)); + pcb_fprintf(f, "[%mm,%mm]], %f);\n", TRX_(x[n]+dx), TRY_(y[n]+dy), effective_layer_thickness); } +static void openscad_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + openscad_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + static void openscad_calibrate(double xval, double yval) { pcb_message(PCB_MSG_ERROR, "openscad_calibrate() not implemented"); @@ -678,6 +683,7 @@ openscad_hid.draw_rect = openscad_draw_rect; openscad_hid.fill_circle = openscad_fill_circle; openscad_hid.fill_polygon = openscad_fill_polygon; + openscad_hid.fill_polygon_offs = openscad_fill_polygon_offs; openscad_hid.fill_rect = openscad_fill_rect; openscad_hid.calibrate = openscad_calibrate; openscad_hid.set_crosshair = openscad_set_crosshair; Index: trunk/src_plugins/export_png/png.c =================================================================== --- trunk/src_plugins/export_png/png.c (revision 12273) +++ trunk/src_plugins/export_png/png.c (revision 12274) @@ -1627,7 +1627,7 @@ gdImageFilledEllipse(im, SCALE_X(cx), SCALE_Y(cy), SCALE(2 * radius + my_bloat), SCALE(2 * radius + my_bloat), gc->color->c); } -static void png_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void png_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int i; gdPoint *points; @@ -1642,8 +1642,8 @@ for (i = 0; i < n_coords; i++) { if (NOT_EDGE(x[i], y[i])) have_outline |= doing_outline; - points[i].x = SCALE_X(x[i]); - points[i].y = SCALE_Y(y[i]); + points[i].x = SCALE_X(x[i]+dx); + points[i].y = SCALE_Y(y[i]+dy); } gdImageSetThickness(im, 0); linewidth = 0; @@ -1651,6 +1651,12 @@ free(points); } +static void png_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + png_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + static void png_calibrate(double xval, double yval) { CRASH("png_calibrate"); @@ -1705,6 +1711,7 @@ png_hid.draw_rect = png_draw_rect; png_hid.fill_circle = png_fill_circle; png_hid.fill_polygon = png_fill_polygon; + png_hid.fill_polygon_offs = png_fill_polygon_offs; png_hid.fill_rect = png_fill_rect; png_hid.calibrate = png_calibrate; png_hid.set_crosshair = png_set_crosshair; Index: trunk/src_plugins/export_ps/eps.c =================================================================== --- trunk/src_plugins/export_ps/eps.c (revision 12273) +++ trunk/src_plugins/export_ps/eps.c (revision 12274) @@ -45,6 +45,7 @@ static void eps_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2); static void eps_fill_circle(pcb_hid_gc_t gc, pcb_coord_t cx, pcb_coord_t cy, pcb_coord_t radius); static void eps_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y); +static void eps_fill_polygon_ffs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy); static void eps_calibrate(double xval, double yval); static void eps_set_crosshair(int x, int y, int action); /*----------------------------------------------------------------------------*/ @@ -582,13 +583,13 @@ pcb_fprintf(f, "%mi %mi %mi %s\n", cx, cy, radius, gc->erase ? "cc" : "c"); } -static void eps_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void eps_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int i; const char *op = "moveto"; use_gc(gc); for (i = 0; i < n_coords; i++) { - pcb_fprintf(f, "%mi %mi %s\n", x[i], y[i], op); + pcb_fprintf(f, "%mi %mi %s\n", x[i] + dx, y[i] + dy, op); op = "lineto"; } @@ -595,6 +596,12 @@ fprintf(f, "fill\n"); } +static void eps_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + eps_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + static void eps_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) { use_gc(gc); @@ -646,6 +653,7 @@ eps_hid.draw_rect = eps_draw_rect; eps_hid.fill_circle = eps_fill_circle; eps_hid.fill_polygon = eps_fill_polygon; + eps_hid.fill_polygon_offs = eps_fill_polygon_offs; eps_hid.fill_rect = eps_fill_rect; eps_hid.calibrate = eps_calibrate; eps_hid.set_crosshair = eps_set_crosshair; Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 12273) +++ trunk/src_plugins/export_ps/ps.c (revision 12274) @@ -1179,18 +1179,24 @@ } } -static void ps_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t * x, pcb_coord_t * y) +static void ps_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) { int i; const char *op = "moveto"; use_gc(gc); for (i = 0; i < n_coords; i++) { - pcb_fprintf(global.f, "%mi %mi %s\n", x[i], y[i], op); + pcb_fprintf(global.f, "%mi %mi %s\n", x[i]+dx, y[i]+dy, op); op = "lineto"; } fprintf(global.f, "fill\n"); } +static void ps_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +{ + ps_fill_polygon_offs(gc, n_coords, x, y, 0, 0); +} + + typedef struct { pcb_coord_t x1, y1, x2, y2; } lseg_t; @@ -1604,6 +1610,7 @@ hid->draw_arc = ps_draw_arc; hid->draw_rect = ps_draw_rect; hid->fill_circle = ps_fill_circle; + hid->fill_polygon_offs = ps_fill_polygon_offs; hid->fill_polygon = ps_fill_polygon; hid->fill_pcb_polygon = ps_fill_pcb_polygon; hid->fill_rect = ps_fill_rect; Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c (revision 12273) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.c (revision 12274) @@ -147,6 +147,13 @@ gpmi_event(h->module, HIDE_fill_polygon, h, gc, x, y); } +void gpmi_hid_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) +{ + gpmi_hid_t *h = hid_gpmi_data_get(pcb_exporter); + /* TODO: need accessor for these */ + gpmi_event(h->module, HIDE_fill_polygon_offs, h, gc, x, y, dx, dy); +} + void gpmi_hid_fill_pcb_polygon(pcb_hid_gc_t gc, pcb_poly_t *poly, const pcb_box_t *clip_box) { /* TODO */ Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.h =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.h (revision 12273) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_callbacks.h (revision 12274) @@ -15,6 +15,7 @@ void gpmi_hid_draw_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2); void gpmi_hid_fill_circle(pcb_hid_gc_t gc, pcb_coord_t cx, pcb_coord_t cy, pcb_coord_t radius); void gpmi_hid_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y); +void gpmi_hid_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy); void gpmi_hid_fill_pcb_polygon(pcb_hid_gc_t gc, pcb_poly_t *poly, const pcb_box_t *clip_box); void gpmi_hid_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2); void gpmi_hid_fill_pcb_pv(pcb_hid_gc_t fg_gc, pcb_hid_gc_t bg_gc, pcb_pin_t *pad, pcb_bool drawHole, pcb_bool mask); Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h (revision 12273) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/hid/hid_events.h (revision 12274) @@ -44,6 +44,9 @@ /* PCB callback events for drawing: draw a filled ploygon */ gpmi_define_event(HIDE_fill_polygon)(void *hid, void *gc, int n_coords, int *x, int *y); +/* PCB callback events for drawing: draw a filled polygon with offs*/ +gpmi_define_event(HIDE_fill_polygon_offs)(void *hid, void *gc, int n_coords, int *x, int *y, int dx, int dy); + /* PCB callback events for drawing: draw a filled rectangle */ gpmi_define_event(HIDE_fill_rect)(void *hid, void *gc, int x1, int y1, int x2, int y2); Index: trunk/src_plugins/loghid/hid-logger.c =================================================================== --- trunk/src_plugins/loghid/hid-logger.c (revision 12273) +++ trunk/src_plugins/loghid/hid-logger.c (revision 12274) @@ -170,6 +170,17 @@ delegatee_->fill_polygon(gc, n_coords, x, y); } +static void log_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) +{ + int i; + pcb_fprintf(out_, "fill_polygon(gc, %d", n_coords); + for (i = 0; i < n_coords; ++i) { + pcb_fprintf(out_, ", (%mm, %mm)", x[i], y[i]); + } + pcb_fprintf(out_, ", {%mm,%mm})\n", dx, dy); + delegatee_->fill_polygon(gc, n_coords, x, y); +} + static void log_fill_pcb_polygon(pcb_hid_gc_t gc, pcb_poly_t *poly, const pcb_box_t *clip_box) { pcb_fprintf(out_, "fill_pcb_polygon(gc, poly->PointN=%d, ...)\n", poly->PointN); @@ -269,6 +280,7 @@ REGISTER_IF_NOT_NULL(draw_rect); REGISTER_IF_NOT_NULL(fill_circle); REGISTER_IF_NOT_NULL(fill_polygon); + REGISTER_IF_NOT_NULL(fill_polygon_offs); REGISTER_IF_NOT_NULL(fill_pcb_polygon); REGISTER_IF_NOT_NULL(thindraw_pcb_polygon); REGISTER_IF_NOT_NULL(fill_pcb_pad);