Commit c7646804 authored by Erik Strand's avatar Erik Strand

Add a border and save an outline image

parent 118ddbdb
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment