-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for sweep gradients in Cairo and CoreGraphics backends #16
Conversation
Thanks! This is really cool. I would love the The idea of "blackrenderer/backends/base.py" is that it contains only two things: 1) abstract base classes that define the interfaces for Canvas and Surface and 2) derived functionality that applies to all backend (such as the Since the sweep gradient support code is not needed for Skia (and may generally depend on the individual backend), I don't think it belongs in base.py. |
@@ -9,27 +9,50 @@ def buildSweepGradientPatches( | |||
startAngle, | |||
endAngle, | |||
useGouraudShading, | |||
maxAngle=-1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more Pythonic way to indicate a default would be None.
maxAngle=-1, | |
maxAngle=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes :-)
if useGouraudShading: | ||
maxAngle = pi / 360.0 | ||
radius = 1.05 * radius # we will use straight-edged triangles | ||
if maxAngle == -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if maxAngle == -1: | |
if maxAngle is None: |
Common code in base.py
Cairo backend uses mesh gradient, so uses fewer curved triangles
CoreGraphics uses flat-shader triangles with acute angle less than half a degree
Edit: this partially addresses #5.