private void ConverToAscii(object sender, RoutedEventArgs e)
        {
            AsciiImageTxb.Text = string.Empty;

            var imageSource = OriginalImageImg.Source as BitmapImage;

            if (imageSource == null)
            {
                throw new Exception("Orifinal image is not BitmapImage");
            }

            var image = new Bitmap(imageSource.UriSource.LocalPath);

            var asciiImage = converter.GetAsciiArt(image);

            for (int i = 0; i < asciiImage.Width; i++)
            {
                for (int j = 0; j < asciiImage.Height; j++)
                {
                    AsciiImageTxb.Text += asciiImage[j, i];
                }
                AsciiImageTxb.Text += Environment.NewLine;
            }

            AsciiImageTxb.FontSize = 8.0f;
        }
示例#2
0
 public void ImageArgumentValidation()
 {
     symbolizer.GetAsciiArt((Image)null, new Font("", 12.0f), palette, new Size(1, 1));
 }