Skip to content

Commit

Permalink
Merge pull request #204 from lucasstarsz/main
Browse files Browse the repository at this point in the history
(#10, #109) add support for curves in DrawUtil#lengthOfPath
  • Loading branch information
lucasstarsz authored May 9, 2022
2 parents 949d3af + 962d951 commit 6b6ce14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/tech/fastj/graphics/util/DrawUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,16 @@ public static int lengthOfPath(Path2D path) {
count++;
break;
}
case PathIterator.SEG_QUADTO: {
count += 2;
break;
}
case PathIterator.SEG_CUBICTO: {
count += 3;
break;
}
default: {
throw new IllegalArgumentException("Path contains curves");
throw new IllegalArgumentException("unknown path segment type " + pi.currentSegment(coords));
}
}
}
Expand Down

0 comments on commit 6b6ce14

Please sign in to comment.