Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
strandstring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Strand
strandstring
Commits
c7646804
Commit
c7646804
authored
6 years ago
by
Erik Strand
Browse files
Options
Downloads
Patches
Plain Diff
Add a border and save an outline image
parent
118ddbdb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
node_board/main.cpp
+14
-3
14 additions, 3 deletions
node_board/main.cpp
with
14 additions
and
3 deletions
node_board/main.cpp
+
14
−
3
View file @
c7646804
...
...
@@ -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
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment