I was minding my own business, eating my Cream of Wheat, watching One Lone Coder when it hit me. I have been sitting on the answer for months. All the pain and torment for nothing. I can't believe I hadn't noticed.
Some time ago I wrote a class that converts an ASCII art file into an array used to draw pixels. I did this because The Swarm game seemed to have a hard time with using images as opposed to just drawing everything. The ASCII solution was to make this task easier. And I have been able to do some graphics stuff that still amazes me. The converted ASCII looks so good. But it is extremely cumbersome. Adding simple graphics takes far longer than it should.
I grabbed a code snippet that made the ASCII solution a bit easier, it allows me to convert images to ASCII, but in a way geared toward my purposes. Even with this helper I still have to go through and define what each ASCII character means colorwise. That means I'm sitting there attempting to map ASCII characters to pixels within the original image.
But wait! I'm converting images to ASCII. Why!? I have everything I need to convert images into an array of information that I can use to draw its pixels in Java. I can cut out the middle man. So the image file is read once, after that I can just use the array. No need to kill myself trying to map and define ASCII character meanings etc. I can just point my code to an image and let it load once, use later.
I have some coding to do!
No comments:
Post a Comment