Пример #1
0
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog();
            op.Title  = "Select a picture";
            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                        "Portable Network Graphic (*.png)|*.png" +
                        "|BMP Windows Bitmap (*.bmp)|*.bmp";

            if (op.ShowDialog() == true)
            {
                imgPhoto.Source       = new BitmapImage(new Uri(op.FileName));
                save_button.IsEnabled = true;
                ListOfCurveArray      = null;
                if (Bitmap != null)
                {
                    Bitmap.Dispose();
                }
                Bitmap = new Bitmap(op.FileName);
                refreshMatrix();
                vectorize();
                Svg = Potrace.Export2SVG(ListOfCurveArray, Bitmap.Width, Bitmap.Height);

                if (HasAtleastOneClue && !string.IsNullOrWhiteSpace(Word.Text))
                {
                    save.IsEnabled = true;
                }
            }
        }
Пример #2
0
 private void saveAsCSVToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ListOfCurveArray == null)
     {
         MessageBox.Show("Please vectorize the image first");
         return;
     }
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         string s = Potrace.Export2SVG(ListOfCurveArray, Bitmap.Width, Bitmap.Height);
         System.IO.StreamWriter FS = new System.IO.StreamWriter(saveFileDialog1.FileName);
         FS.Write(s);
         FS.Close();
     }
 }
Пример #3
0
        private void saveAsSVG(object sender, EventArgs e)
        {
            vectorize();
            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            saveFileDialog.DefaultExt = "svg";
            saveFileDialog.FileName   = "*.svg";
            saveFileDialog.Filter     = "svg files (*.svg)|*.svg";



            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                // le fichier svg a envoyer à la bd.
                string s = Potrace.Export2SVG(ListOfCurveArray, Bitmap.Width, Bitmap.Height);
                // on ne gardera pas ça mais c'est utile pareil
                System.IO.StreamWriter FS = new System.IO.StreamWriter(saveFileDialog.FileName);
                FS.Write(s);
                FS.Close();
            }
        }