示例#1
0
        /// <summary>
        /// Save the image
        /// </summary>
        private void _miFileSave_Click(object sender, System.EventArgs e)
        {
            RasterSaveDialogFileFormatsList saveFormats = new RasterSaveDialogFileFormatsList(RasterDialogFileFormatDataContent.User);
            ImageFileSaver saver = new ImageFileSaver();

            saveFormats.Add(RasterDialogFileTypesIndex.Jpeg2000, RasterDialogBitsPerPixelDataContent.Default);
            saveFormats.Add(RasterDialogFileTypesIndex.Cmw, RasterDialogBitsPerPixelDataContent.Default);
            saveFormats.Add(RasterDialogFileTypesIndex.Jpeg, RasterDialogBitsPerPixelDataContent.Default);
            saveFormats.Add(RasterDialogFileTypesIndex.Lead, RasterDialogBitsPerPixelDataContent.Default);

            saver.SaveFormats = saveFormats;
            saver.FormatIndex = RasterDialogFileTypesIndex.Jpeg2000;

            try
            {
                if (_useROI)
                {
                    _codecs.Options.Jpeg2000.Save.RegionOfInterest = CodecsJpeg2000RegionOfInterest.UseLeadRegion;
                }

                saver.Save(this, _codecs, _viewer.Image);
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
            }
        }
示例#2
0
        public MainForm()
        {
            InitializeComponent();

            InitClass();

            _saver = new ImageFileSaver();
        }
示例#3
0
        public MainForm( )
        {
            InitializeComponent();

            InitClass();

            _saver = new ImageFileSaver();

            LoadImage(true, false);
            UpdateControls();
        }
示例#4
0
        private void _miFileSave_Click(object sender, System.EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            try
            {
                saver.Save(this, _codecs, _viewer.Image);
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
            }
        }
示例#5
0
        // File Menu - SaveAs
        private void _miFileSaveAs_Click(object sender, EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            _isImageSaved = false;

            try
            {
                CapturedImageForm activeForm = ActiveCapturedImageForm;
                saver.Save(this, _codecs, activeForm.Viewer.Image);
                _isImageSaved = true;
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
                _isImageSaved = false;
            }
        }
示例#6
0
        private void _pdfObject_SavePDFImageObjectAs(object sender, EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            try
            {
                RasterImage image = _document.DecodeImage(_selectedPdfImageObject.ImageObjectNumber);
                using (RasterCodecs codecs = new RasterCodecs())
                {
                    DemosGlobal.SetDefaultComments(image, codecs);
                    saver.Save(this, codecs, image);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
            }
        }
示例#7
0
        private void sliceButton_Click(object sender, EventArgs e)
        {
            string nameWithoutExtension = PathHelper.GetFullPathWithoutExtension(fileName);

            try {
                if (radioButton1.Checked)
                {
                    converter = new GifToSpritesheet(gifImg);
                    ImageFileSaver.Save(converter.Convert()[0], nameWithoutExtension);
                }
                else
                {
                    converter = new GifToSprites(gifImg);
                    ImageFileSaver.SaveMultiple(converter.Convert(), nameWithoutExtension);
                }
            } catch (InvalidImageFormatException ex) {
                MessageBox.Show("Selected image either corrupt or is not of .gif format");
            }
        }
示例#8
0
        private void _btnSave_Click(object sender, EventArgs e)
        {
            ImageFileSaver _saver = new ImageFileSaver();

            try
            {
                using (RasterCodecs codecs = new RasterCodecs())
                {
                    using (RasterImage rasterImage = RasterImageConverter.ConvertFromImage(image, ConvertFromImageOptions.None))
                    {
                        DemosGlobal.SetDefaultComments(rasterImage, codecs);
                        _saver.Save(this, codecs, rasterImage);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, _saver.FileName, ex);
            }
        }
示例#9
0
        private void _miFileSave_Click(object sender, System.EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            try
            {
                SaveFileDialog saveDlg = new SaveFileDialog();
                SaveFileDialog sfd     = new SaveFileDialog();
                bool           added   = false;
                for (int i = 0; i < this.MdiChildren.Length; i++)
                {
                    if (((ViewerForm)this.MdiChildren[i]).StandardOptions.Added == true)
                    {
                        added = true;
                    }
                }

                if (!added)
                {
                    Messager.ShowWarning(this, "No image is added, at least one image should be added");
                }
                else
                {
                    sfd.Filter      = @"Acrobat Pdf (*.pdf)|*.pdf";
                    sfd.FilterIndex = 1;
                    if (sfd.ShowDialog(this) == DialogResult.OK)
                    {
                        ApplyPdfSave(sfd.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
            }
        }
示例#10
0
        /// <summary>
        /// save the original image
        /// </summary>
        private void _miFileSave_Click(object sender, System.EventArgs e)
        {
            try
            {
                ImageFileSaver saver = new ImageFileSaver();
                if (saver.Save(this, _codecs, _viewer.Image))
                {
                    // we need to load this new image
                    RasterImage temp = _codecs.Load(saver.FileName);

                    // update the caption
                    Text          = string.Format("{0} - {1}", saver.FileName, Messager.Caption);
                    _viewer.Image = temp;
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
            }
        }