[Tutor] ASCII art generator
Michael Miller
blackmariah@shmups.com
Sun Feb 2 12:15:04 2003
> You better should have told me, that an 7MB file with 250000 font-tags is
> not that nice in a browser ;-)
> Now I'm working with a downscaled image of 50x60 Pixel. That's fine.
> Before spend it a GUI, why not gather the color-info from a couple of
> pixel in case width and or height is about 50!
>
Eep. Yeah, I should have. Really, I should have. Having to sit through a few
hundred thousand pixels being converted to ascii isn't fun. Even a 50x50
image can be tough on a browser. ;) I was thinking of ways to optimize this
thing, and the only ways I could come up with are way beyond my abilities at
this time (I'm working on it though. :).
> \033[A is the ansi-code to scrollback one line, i.e. to the start of the
> last written status (and overwrite it). From here it's not hard to compute
> procents.
>
Muahahahaha! I was just going to ask about that... ;) I'll try out your ideas
real quick and see what sticks.
> your main function needn't a return statement. Leave it away
> (ascgen need it - not to actually return something but to jump out of the
> while loop; on the other hand: a simple "break" would be enough)
Hrm... A bit of an oops there. I'm still damaged from my QBASIC days of 10
years past, apparently. In that, return is used to break out of a loop and
break is used to end a program. It's amazing how the more I learn the more I
understand why it's said that BASIC causes brain damage. A rerereread of the
control flow section in the manual is in order for me now.
> "out" should be a string not a tuple. The html-file becomes cleaner.
You lost me there. The HTML ends up as <FONT color="#70747D">#</FONT>, which
is just fine as far as HTML goes. To show my stupidity a bit more, I thought
it already was a string...
> I assume the file-handling is meant for expert use only and leave this
> point for further versions ;-)
Ehh... pretty much. ;) It will be ironed out. Everything is still in "Just
make it work" mode. Thanks for all the help. I'll try out your idea on the
counter and read up on break/return stuff (I feel really mega stupid for
getting that wrong. DOH).
Michael