Skip to content

Commit

Permalink
Merge pull request #4014 from radarhere/arc
Browse files Browse the repository at this point in the history
Fixed arc drawing bug for a non-whole number of degrees
  • Loading branch information
hugovk committed Sep 5, 2019
2 parents 572a93c + 8fff9a2 commit bd2d7cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Binary file added Tests/images/imagedraw_arc_width_non_whole_angle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Tests/test_imagedraw.py
Expand Up @@ -140,6 +140,18 @@ def test_arc_width_fill(self):
# Assert
self.assert_image_similar(im, Image.open(expected), 1)

def test_arc_width_non_whole_angle(self):
# Arrange
im = Image.new("RGB", (W, H))
draw = ImageDraw.Draw(im)
expected = "Tests/images/imagedraw_arc_width_non_whole_angle.png"

# Act
draw.arc(BBOX1, 10, 259.5, width=5)

# Assert
self.assert_image_similar(im, Image.open(expected), 1)

def test_bitmap(self):
# Arrange
small = Image.open("Tests/images/pil123rgba.png").resize((50, 50))
Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/Draw.c
Expand Up @@ -834,7 +834,7 @@ ellipse(Imaging im, int x0, int y0, int x1, int y1,

// Build edge list
// malloc check UNDONE, FLOAT?
maxEdgeCount = end - start;
maxEdgeCount = ceil(end - start);
if (inner) {
maxEdgeCount *= 2;
}
Expand Down

0 comments on commit bd2d7cb

Please sign in to comment.