/// <summary> /// Renders the provided graph document to an device independent bitmap (TYMED_HGLOBAL). Please not that this format does not support transparancy, thus the back color provided in the rendering options is used as ground brush first. /// </summary> /// <param name="tymed">The tymed to check.</param> /// <param name="document">The graph document.</param> /// <returns>Pointer to the device independent bitmap (TYMED_HGLOBAL).</returns> public static IntPtr RenderAsDIBBitmap_TYMED_HGLOBAL(TYMED tymed, GraphDocumentBase document) { if (!(tymed == TYMED.TYMED_HGLOBAL)) { throw new ArgumentException(nameof(tymed) + " is not TYMED_HGLOBAL"); } var renderingOptions = GetRenderingOptions(document); using (var bmp = Altaxo.Graph.GraphDocumentBaseExportActions.RenderAsBitmap(document, renderingOptions, System.Drawing.Imaging.PixelFormat.Format24bppRgb)) { return(DataObjectHelper.RenderDIBBitmapToHGLOBAL(bmp)); } }
private IntPtr RenderBitmapDIB(TYMED tymed) { ComDebug.ReportInfo("GraphDocumentDataObject.RenderBitmapDIB"); if (!(tymed == TYMED.TYMED_HGLOBAL)) { throw new ArgumentException(nameof(tymed) + " is not TYMED_HGLOBAL"); } if (null != _graphDocumentBitmapImage) { using (var convertedBitmap = GraphDocumentExportActions.ConvertBitmapToPixelFormat(_graphDocumentBitmapImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb, _graphExportOptions.BackgroundColorForFormatsWithoutAlphaChannel)) { return(DataObjectHelper.RenderDIBBitmapToHGLOBAL(convertedBitmap)); } } else { throw new InvalidProgramException("Please report this exception to the author of the program and describe the steps to reproduce the exception"); } }