~rexut/aafigure/python3

« back to all changes in this revision

Viewing changes to aafigure/aafigure.py

  • Committer: zsquareplusc
  • Date: 2009-06-13 12:43:18 UTC
  • Revision ID: zsquareplusc-20090613124318-31voq9c2jmvldhle
- add examples
- cleanup commented out example code
- provide AsciiArtImage on aafigure module level

Show diffs side-by-side

added added

removed removed

Lines of Context:
1177
1177
    else:
1178
1178
        input = sys.stdin
1179
1179
 
1180
 
    #~ def render(text, output, options):
1181
 
        #~ """helper function for tests. scan the given image and create svg output"""
1182
 
        #~ import pprint
1183
 
        #~ aaimg = AsciiArtImage(text)
1184
 
        #~ print text
1185
 
        #~ aaimg.recognize()
1186
 
        #~ aav = aa.AsciiOutputVisitor()
1187
 
        #~ pprint.pprint(aaimg.shapes)
1188
 
        #~ aav.visit(aaimg)
1189
 
        #~ print aav
1190
 
        #~ svgout = svg.SVGOutputVisitor(
1191
 
            #~ file('aafigure_%x.svg' % (long(hash(text)) & 0xffffffffL,), 'w'),
1192
 
            #~ scale = 10
1193
 
        #~ )
1194
 
        #~ svgout.visit(aaimg)
1195
 
 
1196
 
    #~ aaimg = AsciiArtImage("""
1197
 
        #~ ---> | ^|   |
1198
 
        #~ <--- | || --+--
1199
 
        #~ <--> | |V   |
1200
 
     #~ __             __
1201
 
    #~ |  |__  +---+  |__|
1202
 
            #~ |box|   ..
1203
 
            #~ +---+  Xenophon
1204
 
    #~ """)
1205
 
    #~ print aaimg
1206
 
    #~ aaimg.recognize()
1207
 
    #~ print "%r" % aaimg
1208
 
    #~ aav = aa.AsciiOutputVisitor()
1209
 
    #~ aav.visit(aaimg)
1210
 
    #~ print aav
1211
 
 
1212
1180
    if hasattr(options, 'output'):
1213
1181
        output = file(options.output, 'wb')
1214
1182
        delattr(options, 'output')