public static Bitmap RenderAsBitmap(this GraphDocument document, EmbeddedObjectRenderingOptions renderingOptions, PixelFormat pixelFormat = PixelFormat.Format32bppArgb) { BrushX opaqueGround = null; if (!GraphExportOptions.HasPixelFormatAlphaChannel(pixelFormat)) { opaqueGround = new BrushX(renderingOptions.BackgroundColorForFormatsWithoutAlphaChannel); } return(RenderAsBitmap(document, opaqueGround, renderingOptions.BackgroundBrush, pixelFormat, renderingOptions.SourceDpiResolution, renderingOptions.SourceDpiResolution * renderingOptions.OutputScalingFactor)); }
/// <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)); } }
/// <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()); } }