From c764680452564145940c9e23fa38a1d9007b2e8a Mon Sep 17 00:00:00 2001 From: Erik Strand <erik.strand@cba.mit.edu> Date: Fri, 10 May 2019 01:22:35 -0400 Subject: [PATCH] Add a border and save an outline image --- node_board/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/node_board/main.cpp b/node_board/main.cpp index 996fec3..7d61011 100644 --- a/node_board/main.cpp +++ b/node_board/main.cpp @@ -17,7 +17,8 @@ public: min_cut_thickness_(min_cut_thickness), width_px_(to_px(width_)), height_px_(to_px(height_)), min_cut_thickness_px_(to_px(min_cut_thickness_)) { - png_writer_.allocate(width_px_, height_px_); + png_writer_.allocate(width_px_ + 4 * min_cut_thickness_px_, + height_px_ + 4 * min_cut_thickness_px_); png_writer_.set_all_pixels_black(); } @@ -26,7 +27,9 @@ public: } void set_pixel(int32_t x, int32_t y, uint8_t value = 255) { - png_writer_.set_pixel(x, height_px_ - y - 1, value); + png_writer_.set_pixel(2 * min_cut_thickness_px_ + x, + 2 * min_cut_thickness_px_ + height_px_ - y - 1, + value); } void draw_int_rectangle( @@ -64,6 +67,12 @@ public: png_writer_.write(filename); } + void save_outline(char const* filename) { + png_writer_.set_all_pixels_black(); + draw_int_rectangle(0, width_px_, 0, height_px_); + save(filename); + } + public: PngWriter png_writer_; double width_; @@ -157,7 +166,8 @@ int main() { board.draw_rectangle(vcc_pad_x_min, width, 0, - cable_pad_height - min_cut_thickness - min_trace_thickness); + // Note the fudge factor... It makes mods happy. + cable_pad_height - min_cut_thickness - min_trace_thickness - 0.025); board.draw_rectangle(width - min_trace_thickness, width, 0, height); board.draw_rectangle(vcc_pad_x_min, width, @@ -174,6 +184,7 @@ int main() { soic_top_y); board.save("node_board_traces.png"); + board.save_outline("node_board_outline.png"); return 0; } -- GitLab