Showing
4 changed files
with
33 additions
and
7 deletions
| @@ -16,8 +16,32 @@ | @@ -16,8 +16,32 @@ | ||
| 16 | 16 | ||
| 17 | part of pdf; | 17 | part of pdf; |
| 18 | 18 | ||
| 19 | -enum PdfLineCap { joinMiter, joinRound, joinBevel } | 19 | +/// Shape to be used at the corners of paths that are stroked |
| 20 | +enum PdfLineJoin { | ||
| 21 | + /// The outer edges of the strokes for the two segments shall beextended until they meet at an angle, as in a picture frame. If the segments meet at too sharp an angle (as defined by the miter limit parameter, a bevel join shall be used instead. | ||
| 22 | + miter, | ||
| 20 | 23 | ||
| 24 | + /// An arc of a circle with a diameter equal to the line width shall be drawn around the point where the two segments meet, connecting the outer edges of the strokes for the two segments. This pieslice-shaped figure shall be filled in, producing a rounded corner. | ||
| 25 | + round, | ||
| 26 | + | ||
| 27 | + /// The two segments shall be finished with butt caps and the resulting notch beyond the ends of the segments shall be filled with a triangle. | ||
| 28 | + bevel | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +/// Specify the shape that shall be used at the ends of open subpaths | ||
| 32 | +/// and dashes, when they are stroked. | ||
| 33 | +enum PdfLineCap { | ||
| 34 | + /// The stroke shall be squared off at the endpoint of the path. There shall be no projection beyond the end of the path. | ||
| 35 | + butt, | ||
| 36 | + | ||
| 37 | + /// A semicircular arc with a diameter equal to the line width shall be drawn around the endpoint and shall be filled in. | ||
| 38 | + round, | ||
| 39 | + | ||
| 40 | + /// The stroke shall continue beyond the endpoint of the path for a distance equal to half the line width and shall besquared off. | ||
| 41 | + square | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +/// Text rendering mode | ||
| 21 | enum PdfTextRenderingMode { | 45 | enum PdfTextRenderingMode { |
| 22 | /// Fill text | 46 | /// Fill text |
| 23 | fill, | 47 | fill, |
| @@ -531,7 +555,8 @@ class PdfGraphics { | @@ -531,7 +555,8 @@ class PdfGraphics { | ||
| 531 | buf.putString('${cap.index} J\n'); | 555 | buf.putString('${cap.index} J\n'); |
| 532 | } | 556 | } |
| 533 | 557 | ||
| 534 | - void setLineJoin(PdfLineCap join) { | 558 | + /// Set line join type |
| 559 | + void setLineJoin(PdfLineJoin join) { | ||
| 535 | buf.putString('${join.index} j\n'); | 560 | buf.putString('${join.index} j\n'); |
| 536 | } | 561 | } |
| 537 | 562 |
| @@ -260,7 +260,7 @@ class FixedAxis<T extends num> extends GridAxis { | @@ -260,7 +260,7 @@ class FixedAxis<T extends num> extends GridAxis { | ||
| 260 | context.canvas | 260 | context.canvas |
| 261 | ..setStrokeColor(color) | 261 | ..setStrokeColor(color) |
| 262 | ..setLineWidth(width) | 262 | ..setLineWidth(width) |
| 263 | - ..setLineCap(PdfLineCap.joinBevel) | 263 | + ..setLineJoin(PdfLineJoin.bevel) |
| 264 | ..strokePath(); | 264 | ..strokePath(); |
| 265 | 265 | ||
| 266 | for (final y in values) { | 266 | for (final y in values) { |
| @@ -305,7 +305,7 @@ class FixedAxis<T extends num> extends GridAxis { | @@ -305,7 +305,7 @@ class FixedAxis<T extends num> extends GridAxis { | ||
| 305 | context.canvas | 305 | context.canvas |
| 306 | ..setStrokeColor(color) | 306 | ..setStrokeColor(color) |
| 307 | ..setLineWidth(width) | 307 | ..setLineWidth(width) |
| 308 | - ..setLineCap(PdfLineCap.joinBevel) | 308 | + ..setLineJoin(PdfLineJoin.bevel) |
| 309 | ..strokePath(); | 309 | ..strokePath(); |
| 310 | 310 | ||
| 311 | for (final num x in values) { | 311 | for (final num x in values) { |
| @@ -359,7 +359,7 @@ class FixedAxis<T extends num> extends GridAxis { | @@ -359,7 +359,7 @@ class FixedAxis<T extends num> extends GridAxis { | ||
| 359 | context.canvas | 359 | context.canvas |
| 360 | ..setStrokeColor(divisionsColor) | 360 | ..setStrokeColor(divisionsColor) |
| 361 | ..setLineWidth(divisionsWidth) | 361 | ..setLineWidth(divisionsWidth) |
| 362 | - ..setLineCap(PdfLineCap.joinMiter) | 362 | + ..setLineJoin(PdfLineJoin.miter) |
| 363 | ..strokePath(); | 363 | ..strokePath(); |
| 364 | 364 | ||
| 365 | if (divisionsDashed) { | 365 | if (divisionsDashed) { |
| @@ -170,8 +170,8 @@ class LineDataSet extends Dataset { | @@ -170,8 +170,8 @@ class LineDataSet extends Dataset { | ||
| 170 | context.canvas | 170 | context.canvas |
| 171 | ..setStrokeColor(color) | 171 | ..setStrokeColor(color) |
| 172 | ..setLineWidth(lineWidth) | 172 | ..setLineWidth(lineWidth) |
| 173 | - ..setLineCap(PdfLineCap.joinRound) | ||
| 174 | - ..setLineJoin(PdfLineCap.joinRound) | 173 | + ..setLineCap(PdfLineCap.round) |
| 174 | + ..setLineJoin(PdfLineJoin.round) | ||
| 175 | ..strokePath(); | 175 | ..strokePath(); |
| 176 | } | 176 | } |
| 177 | 177 |
-
Please register or login to post a comment