summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-12-19 21:54:29 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-12-19 21:54:29 -0500
commit1cb269131bc52f0b1a1e69cef0466f2d994d52a8 (patch)
tree25555820946f2d7a7eac9b242bb160a883e8b0ad /examples
parent2e2b4e49c3182cc7385f12d760222ecb57cc1356 (diff)
downloadgerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.tar.gz
gerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.tar.bz2
gerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.zip
Allow negative render of soldermask per #50
Update example code and rendering to show change
Diffstat (limited to 'examples')
-rw-r--r--examples/cairo_example.pngbin110829 -> 104949 bytes
-rw-r--r--examples/cairo_example.py19
2 files changed, 12 insertions, 7 deletions
diff --git a/examples/cairo_example.png b/examples/cairo_example.png
index 485586e..fc4536a 100644
--- a/examples/cairo_example.png
+++ b/examples/cairo_example.png
Binary files differ
diff --git a/examples/cairo_example.py b/examples/cairo_example.py
index a312e89..f2f6723 100644
--- a/examples/cairo_example.py
+++ b/examples/cairo_example.py
@@ -25,7 +25,7 @@ a .png file.
import os
from gerber import read
-from gerber.render import GerberCairoContext
+from gerber.render import GerberCairoContext, theme
GERBER_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), 'gerbers'))
@@ -40,25 +40,30 @@ drill = read(os.path.join(GERBER_FOLDER, 'ncdrill.DRD'))
# Create a new drawing context
ctx = GerberCairoContext()
+# Set opacity and color for copper layer
+ctx.alpha = 1.0
+ctx.color = theme.COLORS['hasl copper']
+
# Draw the copper layer
copper.render(ctx)
# Set opacity and color for soldermask layer
-ctx.alpha = 0.6
-ctx.color = (0.2, 0.2, 0.75)
+ctx.alpha = 0.75
+ctx.color = theme.COLORS['green soldermask']
# Draw the soldermask layer
-mask.render(ctx)
+mask.render(ctx, invert=True)
# Set opacity and color for silkscreen layer
-ctx.alpha = 0.85
-ctx.color = (1, 1, 1)
+ctx.alpha = 1.0
+ctx.color = theme.COLORS['white']
# Draw the silkscreen layer
silk.render(ctx)
# Set opacity for drill layer
-ctx.alpha = 1.
+ctx.alpha = 1.0
+ctx.color = theme.COLORS['black']
drill.render(ctx)
# Write output to png file