Merge pull request #1255 from radarhere/polygon

Fixed polygon edge drawing
This commit is contained in:
wiredfool 2015-06-17 18:18:36 -07:00
commit d2e54d7973
3 changed files with 15 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

View File

@ -124,6 +124,19 @@ class TestImageDraw(PillowTestCase):
def test_ellipse2(self):
self.helper_ellipse(BBOX2)
def test_ellipse_edge(self):
# Arrange
im = Image.new("RGB", (W, H))
draw = ImageDraw.Draw(im)
# Act
draw.ellipse(((0, 0), (W-1, H)), fill="white")
del draw
# Assert
self.assert_image_similar(
im, Image.open("Tests/images/imagedraw_ellipse_edge.png"), 1)
def helper_line(self, points):
# Arrange
im = Image.new("RGB", (W, H))

View File

@ -457,8 +457,8 @@ polygon_generic(Imaging im, int n, Edge *e, int ink, int eofill,
if (ymin < 0) {
ymin = 0;
}
if (ymax >= im->ysize) {
ymax = im->ysize - 1;
if (ymax > im->ysize) {
ymax = im->ysize;
}
/* Process the edge table with a scan line searching for intersections */