示例#1
0
        const int CONSOLE_W            = 80;                // console width in chars

        static void Main(string[] args)
        {
            var options = new PicToAsciiOptions()
            {
                FixedDimension    = PicToAsciiOptions.Fix.Horizontal,
                FixedSize         = CONSOLE_W,
                SymbolAspectRatio = FONT_ASPECT
            };

            var pic2ascii = new PicToAscii(options);

            foreach (var filename in ImageSamples)
            {
                IReadOnlyList <ColorTape> colorTapes;
                try {
                    using Stream stream = File.OpenRead(filename);

                    pic2ascii.Options.AsciiTable = Environment.TickCount % 2 == 0
                        ? PicToAsciiOptions.ASCIITABLE_SOLID
                        : PicToAsciiOptions.ASCIITABLE_SYMBOLIC;

                    //colorTapes = PicToAscii.CreateDefault.Convert(stream);
                    colorTapes = pic2ascii.Convert(stream);
                }
                catch {
                    continue;
                }

                PrintTapes(colorTapes);

                Console.ReadLine();
                Console.Clear();
            }
        }
示例#2
0
 public PicToAscii(PicToAsciiOptions options)
 {
     Options = options;
 }