summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/render/cairo_backend.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-06-13 22:32:04 +0200
committerjaseg <git@jaseg.de>2021-06-13 22:32:04 +0200
commit0b8e99f79a168c1899949b7466755b4f8e06bac3 (patch)
tree72d9f7c09dd247371b436c3628764b2b63cfb99f /gerbonara/gerber/render/cairo_backend.py
parent5225d3da8bdd4ed2b33e43692a4e1a340eb4989b (diff)
downloadgerbonara-0b8e99f79a168c1899949b7466755b4f8e06bac3.tar.gz
gerbonara-0b8e99f79a168c1899949b7466755b4f8e06bac3.tar.bz2
gerbonara-0b8e99f79a168c1899949b7466755b4f8e06bac3.zip
Remove single-quadrant support
The gerber spec is pretty explicit that this is a super-legacy feature that is not worth supporting. Looking at gerbv, an implementation would come with considerable complexity.
Diffstat (limited to 'gerbonara/gerber/render/cairo_backend.py')
-rw-r--r--gerbonara/gerber/render/cairo_backend.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gerbonara/gerber/render/cairo_backend.py b/gerbonara/gerber/render/cairo_backend.py
index ff92d99..ff5e6cb 100644
--- a/gerbonara/gerber/render/cairo_backend.py
+++ b/gerbonara/gerber/render/cairo_backend.py
@@ -23,6 +23,7 @@ except ImportError:
from operator import mul
import tempfile
+import warnings
import os
from .render import GerberContext, RenderSettings
@@ -235,7 +236,11 @@ class GerberCairoContext(GerberContext):
two_pi = 2 * math.pi
angle1 = (arc.start_angle + two_pi) % two_pi
angle2 = (arc.end_angle + two_pi) % two_pi
- if angle1 == angle2 and arc.quadrant_mode != 'single-quadrant':
+
+ if arc.quadrant_mode == 'single-quadrant':
+ warnings.warn('Cairo backend does not support single-quadrant arcs.')
+
+ if angle1 == angle2:
# Make the angles slightly different otherwise Cario will draw nothing
angle2 -= 0.000000001
if isinstance(arc.aperture, Circle):
@@ -255,8 +260,7 @@ class GerberCairoContext(GerberContext):
if arc.direction == 'counterclockwise':
mask.ctx.arc(center[0], center[1], radius, angle1, angle2)
else:
- mask.ctx.arc_negative(center[0], center[1], radius,
- angle1, angle2)
+ mask.ctx.arc_negative(center[0], center[1], radius, angle1, angle2)
mask.ctx.move_to(*end) # ...lame
mask.ctx.stroke()