mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Merge pull request #1255 from radarhere/polygon
Fixed polygon edge drawing
This commit is contained in:
commit
d2e54d7973
BIN
Tests/images/imagedraw_ellipse_edge.png
Normal file
BIN
Tests/images/imagedraw_ellipse_edge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 602 B |
|
@ -124,6 +124,19 @@ class TestImageDraw(PillowTestCase):
|
||||||
def test_ellipse2(self):
|
def test_ellipse2(self):
|
||||||
self.helper_ellipse(BBOX2)
|
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):
|
def helper_line(self, points):
|
||||||
# Arrange
|
# Arrange
|
||||||
im = Image.new("RGB", (W, H))
|
im = Image.new("RGB", (W, H))
|
||||||
|
|
|
@ -457,8 +457,8 @@ polygon_generic(Imaging im, int n, Edge *e, int ink, int eofill,
|
||||||
if (ymin < 0) {
|
if (ymin < 0) {
|
||||||
ymin = 0;
|
ymin = 0;
|
||||||
}
|
}
|
||||||
if (ymax >= im->ysize) {
|
if (ymax > im->ysize) {
|
||||||
ymax = im->ysize - 1;
|
ymax = im->ysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process the edge table with a scan line searching for intersections */
|
/* Process the edge table with a scan line searching for intersections */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user