(sprito.py) Store part of the screen in SpriteRaw with store_rect()
This commit is contained in:
parent
0e72a3c3c3
commit
dd341eb7dd
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue