(sprito.py) Store part of the screen in SpriteRaw with store_rect()

This commit is contained in:
KikooDX 2020-04-12 18:01:22 +02:00
parent 0e72a3c3c3
commit dd341eb7dd
1 changed files with 7 additions and 0 deletions

View File

@ -36,6 +36,13 @@ class SpriteRaw(SpriteIndexed):
def to_raw(self) -> None:
return None
def store_rect(x: int, y: int, w:int, h: int) -> SpriteRaw:
result = []
for i in range(y, y + h):
for j in range(x, x + w):
result.append(get_pixel(j, i))
return SpriteRaw(w, h, result)
def rect(x: int, y: int, w: int, h: int, color: tuple) -> None:
for i in range(x, x + w):
for j in range(y, y + h):