Merge pull request #1701 from blink1073/fix-draw-polygon-1700

Allow draw.polygon to take a list or tuple (closes #1700)
This commit is contained in:
Stefan van der Walt
2015-09-05 22:26:04 -07:00
2 changed files with 3 additions and 2 deletions
+2
View File
@@ -268,6 +268,8 @@ def polygon(y, x, shape=None):
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
"""
x = np.asanyarray(x)
y = np.asanyarray(y)
cdef Py_ssize_t nr_verts = x.shape[0]
cdef Py_ssize_t minr = int(max(0, y.min()))
+1 -2
View File
@@ -122,9 +122,8 @@ def test_line_equal_aliasing_horizontally_vertically():
def test_polygon_rectangle():
img = np.zeros((10, 10), 'uint8')
poly = np.array(((1, 1), (4, 1), (4, 4), (1, 4), (1, 1)))
rr, cc = polygon(poly[:, 0], poly[:, 1])
rr, cc = polygon((1, 4, 4, 1, 1), (1, 1, 4, 4, 1))
img[rr, cc] = 1
img_ = np.zeros((10, 10))