Showing
2 changed files
with
7 additions
and
8 deletions
| 1 | # 1.1.1 | 1 | # 1.1.1 |
| 2 | * Improve PdfPoint and PdfRect | 2 | * Improve PdfPoint and PdfRect |
| 3 | * Change PdfColor.fromInt to const constructor | 3 | * Change PdfColor.fromInt to const constructor |
| 4 | +* Fix drawShape Bézier curves | ||
| 4 | 5 | ||
| 5 | # 1.1.0 | 6 | # 1.1.0 |
| 6 | * Rename classes to satisfy Dart conventions | 7 | * Rename classes to satisfy Dart conventions |
| @@ -278,10 +278,10 @@ class PdfGraphics { | @@ -278,10 +278,10 @@ class PdfGraphics { | ||
| 278 | break; | 278 | break; |
| 279 | case 'C': // cubic bezier, absolute | 279 | case 'C': // cubic bezier, absolute |
| 280 | var len = 0; | 280 | var len = 0; |
| 281 | - while ((len + 1) * 6 <= points.length) { | 281 | + while (len < points.length) { |
| 282 | curveTo(points[len + 0], points[len + 1], points[len + 2], | 282 | curveTo(points[len + 0], points[len + 1], points[len + 2], |
| 283 | points[len + 3], points[len + 4], points[len + 5]); | 283 | points[len + 3], points[len + 4], points[len + 5]); |
| 284 | - len += 1; | 284 | + len += 6; |
| 285 | } | 285 | } |
| 286 | lastPoint = | 286 | lastPoint = |
| 287 | PdfPoint(points[points.length - 2], points[points.length - 1]); | 287 | PdfPoint(points[points.length - 2], points[points.length - 1]); |
| @@ -307,7 +307,7 @@ class PdfGraphics { | @@ -307,7 +307,7 @@ class PdfGraphics { | ||
| 307 | break; | 307 | break; |
| 308 | case 'c': // cubic bezier, relative | 308 | case 'c': // cubic bezier, relative |
| 309 | var len = 0; | 309 | var len = 0; |
| 310 | - while ((len + 1) * 6 <= points.length) { | 310 | + while (len < points.length) { |
| 311 | points[len + 0] += lastPoint.x; | 311 | points[len + 0] += lastPoint.x; |
| 312 | points[len + 1] += lastPoint.y; | 312 | points[len + 1] += lastPoint.y; |
| 313 | points[len + 2] += lastPoint.x; | 313 | points[len + 2] += lastPoint.x; |
| @@ -316,12 +316,10 @@ class PdfGraphics { | @@ -316,12 +316,10 @@ class PdfGraphics { | ||
| 316 | points[len + 5] += lastPoint.y; | 316 | points[len + 5] += lastPoint.y; |
| 317 | curveTo(points[len + 0], points[len + 1], points[len + 2], | 317 | curveTo(points[len + 0], points[len + 1], points[len + 2], |
| 318 | points[len + 3], points[len + 4], points[len + 5]); | 318 | points[len + 3], points[len + 4], points[len + 5]); |
| 319 | - len += 1; | 319 | + lastPoint = PdfPoint(points[len + 4], points[len + 5]); |
| 320 | + lastControl = PdfPoint(points[len + 2], points[len + 3]); | ||
| 321 | + len += 6; | ||
| 320 | } | 322 | } |
| 321 | - lastPoint = | ||
| 322 | - PdfPoint(points[points.length - 2], points[points.length - 1]); | ||
| 323 | - lastControl = | ||
| 324 | - PdfPoint(points[points.length - 4], points[points.length - 3]); | ||
| 325 | break; | 323 | break; |
| 326 | case 's': // smooth cubic bézier, relative | 324 | case 's': // smooth cubic bézier, relative |
| 327 | while (points.length >= 4) { | 325 | while (points.length >= 4) { |
-
Please register or login to post a comment