Skip to content

Commit

Permalink
(#10, #109) add support for curves in DrawUtil#lengthOfPath
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasstarsz committed May 9, 2022
1 parent 949d3af commit 962d951
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 962d951

Please sign in to comment.