Ejemplo n.º 1
0
        private void DragDropMethod(DragEventArgs e)
        {
            string[] filenames = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (filenames.Length == 0 || !File.Exists(filenames[0]))
            {
                return;
            }

            Image  image    = null;
            string filename = "";
            int    width    = 0;
            int    height   = 0;

            try
            {
                filename = filenames[0];
                image    = Bitmap.FromFile(filename);

                Image imgOld = pbxData.Image;
                pbxData.Image = (Image)image.Clone();

                if (imgOld != null)
                {
                    imgOld.Dispose();
                    imgOld = null;
                }

                width  = image.Width;
                height = image.Height;

                string jpgFilename = Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + "_Omni.jpg";

                image.Save(jpgFilename, System.Drawing.Imaging.ImageFormat.Jpeg);

                Jpeg2Omni jpg2omni = new Jpeg2Omni(jpgFilename, width, height);

                bgWorker.RunWorkerAsync(jpg2omni);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                return;
            }
        }
Ejemplo n.º 2
0
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            Jpeg2Omni jpg2omni = (Jpeg2Omni)e.Argument;

            jpg2omni.WriteMetaBlock();
        }