Skip to content

Commit

Permalink
support for python < 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
raulgilabert committed Oct 20, 2022
1 parent 9a51cfd commit d5f127f
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,34 @@ def detect_borders(image):
x = pos%width
y = int(pos/width)

match num:
case 2 | 5:
while image.getpixel((x, y)) == (0, 0, 0):
x = pos%width
y = int(pos/width)
if num == 2 or num == 5:
while image.getpixel((x, y)) == (0, 0, 0):
x = pos%width
y = int(pos/width)

pos += width
pos += width

borders[int(num/3)][3] = y
num += 1
borders[int(num/3)][3] = y
num += 1

case 1 | 4:
while image.getpixel((x, y)) == (0, 0, 0):
x = pos%width
y = int(pos/width)

pos += 1
if num == 1 or num == 4:
while image.getpixel((x, y)) == (0, 0, 0):
x = pos%width
y = int(pos/width)


borders[int(num/3)][1] = x
pos += 1

pos -= 3
num += 1

borders[int(num/3)][1] = x

case 0 | 3:
if image.getpixel((x, y)) == (0, 0, 0):
num += 1
borders[int(num/3)][0] = x
borders[int(num/3)][2] = y
pos -= 3
num += 1

if num == 0 or num == 3:
if image.getpixel((x, y)) == (0, 0, 0):
num += 1
borders[int(num/3)][0] = x
borders[int(num/3)][2] = y

pos += 1

Expand Down

0 comments on commit d5f127f

Please sign in to comment.