|
8 | 8 | from .base import Canvas, Surface |
9 | 9 | from .sweepGradient import buildSweepGradientPatches |
10 | 10 |
|
11 | | - |
12 | 11 | _compositeModeMap = { |
13 | 12 | CompositeMode.CLEAR: CG.kCGBlendModeClear, |
14 | 13 | CompositeMode.SRC: CG.kCGBlendModeCopy, |
@@ -177,8 +176,12 @@ def drawPathRadialGradient( |
177 | 176 | if extendMode in (ExtendMode.REPEAT, ExtendMode.REFLECT): |
178 | 177 | colorLine, startCenter, startRadius, endCenter, endRadius = ( |
179 | 178 | _expandRadialGradient( |
180 | | - self.context, colorLine, |
181 | | - startCenter, startRadius, endCenter, endRadius, |
| 179 | + self.context, |
| 180 | + colorLine, |
| 181 | + startCenter, |
| 182 | + startRadius, |
| 183 | + endCenter, |
| 184 | + endRadius, |
182 | 185 | extendMode, |
183 | 186 | ) |
184 | 187 | ) |
@@ -222,8 +225,13 @@ def drawPathSweepGradient( |
222 | 225 | R = sqrt(maxX + maxY) |
223 | 226 | # compute the triangle fan approximating the sweep gradient |
224 | 227 | patches = buildSweepGradientPatches( |
225 | | - colorLine, center, R, startAngle, endAngle, |
226 | | - useGouraudShading=True, extendMode=extendMode, |
| 228 | + colorLine, |
| 229 | + center, |
| 230 | + R, |
| 231 | + startAngle, |
| 232 | + endAngle, |
| 233 | + useGouraudShading=True, |
| 234 | + extendMode=extendMode, |
227 | 235 | ) |
228 | 236 | CG.CGContextBeginTransparencyLayer(self.context, None) |
229 | 237 | CG.CGContextSetAllowsAntialiasing(self.context, False) |
@@ -260,9 +268,7 @@ def _expandLinearGradient(context, colorLine, pt1, pt2, extendMode): |
260 | 268 | """ |
261 | 269 | # Get clip bounds in gradient space (after gradientTransform was applied) |
262 | 270 | (bx, by), (bw, bh) = CG.CGContextGetClipBoundingBox(context) |
263 | | - corners = [ |
264 | | - (bx, by), (bx + bw, by), (bx, by + bh), (bx + bw, by + bh) |
265 | | - ] |
| 271 | + corners = [(bx, by), (bx + bw, by), (bx, by + bh), (bx + bw, by + bh)] |
266 | 272 |
|
267 | 273 | # Compute gradient direction vector |
268 | 274 | dx = pt2[0] - pt1[0] |
@@ -323,9 +329,7 @@ def _expandRadialGradient( |
323 | 329 | Extends both inward (t < 0) and outward (t > 1) to cover the visible area. |
324 | 330 | """ |
325 | 331 | (bx, by), (bw, bh) = CG.CGContextGetClipBoundingBox(context) |
326 | | - corners = [ |
327 | | - (bx, by), (bx + bw, by), (bx, by + bh), (bx + bw, by + bh) |
328 | | - ] |
| 332 | + corners = [(bx, by), (bx + bw, by), (bx, by + bh), (bx + bw, by + bh)] |
329 | 333 |
|
330 | 334 | radiusDiff = endRadius - startRadius |
331 | 335 | centerDx = endCenter[0] - startCenter[0] |
|
0 commit comments