mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Merge pull request #6303 from radarhere/disconnected
Only try to connect discontiguous corners at the end of edges
This commit is contained in:
commit
71d6a7b14f
|
@ -1452,3 +1452,11 @@ def test_discontiguous_corners_polygon():
|
||||||
)
|
)
|
||||||
expected = os.path.join(IMAGES_PATH, "discontiguous_corners_polygon.png")
|
expected = os.path.join(IMAGES_PATH, "discontiguous_corners_polygon.png")
|
||||||
assert_image_similar_tofile(img, expected, 1)
|
assert_image_similar_tofile(img, expected, 1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_polygon():
|
||||||
|
im = Image.new("RGB", (W, H))
|
||||||
|
draw = ImageDraw.Draw(im)
|
||||||
|
draw.polygon([(18, 30), (19, 31), (18, 30), (85, 30), (60, 72)], "red")
|
||||||
|
expected = "Tests/images/imagedraw_outline_polygon_RGB.png"
|
||||||
|
assert_image_similar_tofile(im, expected, 1)
|
||||||
|
|
|
@ -513,7 +513,9 @@ polygon_generic(Imaging im, int n, Edge *e, int ink, int eofill, hline_handler h
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Check if the two edges join to make a corner
|
// Check if the two edges join to make a corner
|
||||||
if (xx[j-1] == (ymin - other_edge->y0) * other_edge->dx + other_edge->x0) {
|
if (((ymin == current->ymin && ymin == other_edge->ymin) ||
|
||||||
|
(ymin == current->ymax && ymin == other_edge->ymax)) &&
|
||||||
|
xx[j-1] == (ymin - other_edge->y0) * other_edge->dx + other_edge->x0) {
|
||||||
// Determine points from the edges on the next row
|
// Determine points from the edges on the next row
|
||||||
// Or if this is the last row, check the previous row
|
// Or if this is the last row, check the previous row
|
||||||
int offset = ymin == ymax ? -1 : 1;
|
int offset = ymin == ymax ? -1 : 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user