Created
October 9, 2012 19:39
-
-
Save pydsigner/3860963 to your computer and use it in GitHub Desktop.
Mask to PixList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pgpu.iter_utils import flatten | |
def get_set(mask): | |
xsize, ysize = mask.get_size() | |
# return a 1D list of all the mask locations that are set | |
return flatten((((x, y) for y in range(ysize) if mask.get_at((x, y))) | |
for x in range(xsize)), 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment