Added rectangle tool
This commit is contained in:
parent
7889d58170
commit
b61dc0efa8
|
@ -39,6 +39,9 @@ class AsyncBotManager:
|
|||
if a:
|
||||
self.put_index(index, l > 0)
|
||||
|
||||
def put_pixel(self, x: int, y: int, val: bool):
|
||||
self.put_index(x + y * 1000, val)
|
||||
|
||||
def put_index(self, index: int, value: bool):
|
||||
if not index in self.avoid:
|
||||
self.difference[index] = value
|
||||
|
@ -186,6 +189,10 @@ async def amain():
|
|||
mgr.put_index(
|
||||
ndx_start + i, ((color >> i) & 1) > 0
|
||||
)
|
||||
elif elem["type"] == "rect":
|
||||
for y in range(elem["y"], elem["y"] + elem["h"]):
|
||||
for x in range(elem["x"], elem["x"] + elem["w"]):
|
||||
mgr.put_pixel(x, y, elem["fill"])
|
||||
|
||||
mgr.get_difference_image().save("result.png")
|
||||
mgr.get_avoid_image().save("avoid.png")
|
||||
|
|
Loading…
Reference in New Issue