Exemple #1
0
 /// <summary>
 /// Renders the graph document as bitmap with default PixelFormat.Format32bppArgb.
 /// </summary>
 /// <param name="document">The graph document used.</param>
 /// <param name="renderingOptions">The embedded rendering export options.</param>
 /// <param name="pixelFormat">The pixel format for the bitmap. Default is PixelFormat.Format32bppArgb.</param>
 /// <returns>The rendered enhanced metafile.</returns>
 public static System.Drawing.Bitmap RenderAsBitmap(GraphDocumentBase document, EmbeddedObjectRenderingOptions renderingOptions, PixelFormat pixelFormat)
 {
     if (document is Gdi.GraphDocument)
     {
         return(Gdi.GraphDocumentExportActions.RenderAsBitmap((Gdi.GraphDocument)document, renderingOptions, pixelFormat));
     }
     else
     {
         return(Graph3D.GraphDocumentExportActions.RenderAsBitmap((Graph3D.GraphDocument)document, renderingOptions, pixelFormat));
     }
 }
Exemple #2
0
        public static void ShowFileExportSpecificDialog(this GraphDocumentBase doc)
        {
            object resopt = _graphExportOptionsToFile;

            if (Current.Gui.ShowDialog(ref resopt, "Choose export options"))
            {
                _graphExportOptionsToFile = (GraphExportOptions)resopt;
            }
            else
            {
                return;
            }
            ShowFileExportDialog(doc, _graphExportOptionsToFile);
        }
Exemple #3
0
        public static void ShowFileExportDialog(this GraphDocumentBase doc, GraphExportOptions graphExportOptions)
        {
            var saveOptions = new Altaxo.Gui.SaveFileOptions();
            var list        = GetFileFilterString(graphExportOptions.ImageFormat);

            foreach (var entry in list)
            {
                saveOptions.AddFilter(entry.Key, entry.Value);
            }
            saveOptions.FilterIndex      = 0;
            saveOptions.RestoreDirectory = true;

            if (Current.Gui.ShowSaveFileDialog(saveOptions))
            {
                using (Stream myStream = new FileStream(saveOptions.FileName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read)) // we need FileAccess.ReadWrite when exporting to EMF/WMF format
                {
                    var exporter = Current.ProjectService.GetProjectItemImageExporter(doc);
                    exporter?.ExportAsImageToStream(doc, graphExportOptions, myStream);
                    myStream.Close();
                } // end openfile ok
            }     // end dlgresult ok
        }
Exemple #4
0
 /// <summary>
 /// Renders the graph document as enhanced metafile image in vector format with the options given in <paramref name="renderingOptions"/>
 /// </summary>
 /// <param name="document">The graph document used.</param>
 /// <param name="renderingOptions">The embedded rendering export options.</param>
 /// <returns>The rendered enhanced metafile.</returns>
 public static System.Drawing.Imaging.Metafile RenderAsEnhancedMetafileVectorFormat(GraphDocumentBase document, EmbeddedObjectRenderingOptions renderingOptions)
 {
     if (document is Gdi.GraphDocument)
     {
         return(Gdi.GraphDocumentExportActions.RenderAsEnhancedMetafileVectorFormat((Gdi.GraphDocument)document, renderingOptions));
     }
     else
     {
         throw new NotImplementedException("Render as metafile is not supported for graph documents of type " + document.GetType());
     }
 }