-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add japanese character filter #88
Conversation
This commit adds a filter, which uses japanese hiraganas to display the pixels. (Add japanese.py) See #69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick checkout, code doesn't work. List index out of range, check your symbols indexing carefully and test your code to make sure it works before submitting.
def filter( | ||
self, image: List[List[Tuple[int, int, int, int]]]) -> List[List[Tuple[int, int, int, int]]]: | ||
"""Process an ASCII image and return an image of the same format and dims""" | ||
symbols = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len() and indexing also work on strings, and I think you'll find that doing this on a single string performs a bit faster.
symbols = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', | ||
'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', | ||
'る', 'れ', 'ろ', 'わ', 'を'] | ||
return [[(symbols[randint(0, len(symbols))], j[1], j[2], 0) for j in i] for i in image] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know a lot of the existing filters are context free character substitutions, I probably didn't set the best precedent by approving all those filters that only replace the whole screen with one character, but it'd be kinda nice if newer ones pushed the boundaries a little and did some sort of shade thing like I did with the newer shovels filter
""" | ||
self.textOp = True | ||
self.name = "Japanese" | ||
self.description = "Fill the image with random japanese letters" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think letters is a european alphabet name, think these are characters.
Closing because doesn't work and doesn't look like this is going to get fixed |
This commit adds a filter, which uses japanese hiraganas to display the pixels. (Add japanese.py)
See #69