summaryrefslogtreecommitdiff
path: root/gerber/render/cairo_backend.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-15 03:29:47 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-15 03:29:47 -0500
commitbfe14841604b6be403e7123e8b6667b1f0aff6f6 (patch)
treef33b8808412932c8606e63c9a11dcd4e60b919a9 /gerber/render/cairo_backend.py
parent5cf1fa74b42eb8feaab23078bef6f31f6d647c33 (diff)
downloadgerbonara-bfe14841604b6be403e7123e8b6667b1f0aff6f6.tar.gz
gerbonara-bfe14841604b6be403e7123e8b6667b1f0aff6f6.tar.bz2
gerbonara-bfe14841604b6be403e7123e8b6667b1f0aff6f6.zip
Add cairo example code, and use example-generated image in readme
Diffstat (limited to 'gerber/render/cairo_backend.py')
-rw-r--r--gerber/render/cairo_backend.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py
index 999269b..18d1ceb 100644
--- a/gerber/render/cairo_backend.py
+++ b/gerber/render/cairo_backend.py
@@ -22,7 +22,7 @@ import math
from ..primitives import *
-SCALE = 400.
+SCALE = 4000.
class GerberCairoContext(GerberContext):
@@ -42,10 +42,12 @@ class GerberCairoContext(GerberContext):
self.background = False
def set_bounds(self, bounds):
- xbounds, ybounds = bounds
- self.ctx.rectangle(SCALE * xbounds[0], SCALE * ybounds[0], SCALE * (xbounds[1]- xbounds[0]), SCALE * (ybounds[1] - ybounds[0]))
- self.ctx.set_source_rgb(0,0,0)
- self.ctx.fill()
+ if not self.background:
+ xbounds, ybounds = bounds
+ self.ctx.rectangle(SCALE * xbounds[0], SCALE * ybounds[0], SCALE * (xbounds[1]- xbounds[0]), SCALE * (ybounds[1] - ybounds[0]))
+ self.ctx.set_source_rgb(0,0,0)
+ self.ctx.fill()
+ self.background = True
def _render_line(self, line, color):
start = map(mul, line.start, self.scale)