コード例 #1
0
ファイル: PdfExporter.cs プロジェクト: benjaminrupp/oxyplot
 /// <summary>
 /// Exports the specified <see cref="PlotModel" /> to the specified <see cref="Stream" />.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="stream">The stream.</param>
 public void Export(IPlotModel model, Stream stream)
 {
     var rc = new PdfRenderContext(this.Width, this.Height, this.Background);
     model.Update(true);
     model.Render(rc, this.Width, this.Height);
     rc.Save(stream);
 }
コード例 #2
0
        /// <summary>
        /// Exports the specified <see cref="PlotModel" /> to the specified <see cref="Stream" />.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="stream">The stream.</param>
        public void Export(IPlotModel model, Stream stream)
        {
            var rc = new PdfRenderContext(this.Width, this.Height, model.Background);

            model.Update(true);
            model.Render(rc, new OxyRect(0, 0, this.Width, this.Height));
            rc.Save(stream);
        }
コード例 #3
0
ファイル: SvgExporter.cs プロジェクト: huoxudong125/oxyplot
        /// <summary>
        /// Exports the specified model to a stream.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="stream">The output stream.</param>
        /// <param name="width">The width (points).</param>
        /// <param name="height">The height (points).</param>
        /// <param name="isDocument">if set to <c>true</c>, the xml headers will be included (?xml and !DOCTYPE).</param>
        /// <param name="textMeasurer">The text measurer.</param>
        public static void Export(IPlotModel model, Stream stream, double width, double height, bool isDocument, IRenderContext textMeasurer = null)
        {
            if (textMeasurer == null)
            {
                textMeasurer = new PdfRenderContext(width, height, model.Background);
            }

            using (var rc = new SvgRenderContext(stream, width, height, true, textMeasurer, model.Background))
            {
                model.Update(true);
                model.Render(rc, width, height);
                rc.Complete();
                rc.Flush();
            }
        }
コード例 #4
0
        /// <summary>
        /// Exports the specified model to a stream.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="stream">The output stream.</param>
        /// <param name="width">The width (points).</param>
        /// <param name="height">The height (points).</param>
        /// <param name="isDocument">if set to <c>true</c>, the xml headers will be included (?xml and !DOCTYPE).</param>
        /// <param name="textMeasurer">The text measurer.</param>
        public static void Export(IPlotModel model, Stream stream, double width, double height, bool isDocument, IRenderContext textMeasurer = null)
        {
            if (textMeasurer == null)
            {
                textMeasurer = new PdfRenderContext(width, height, model.Background);
            }

            using (var rc = new SvgRenderContext(stream, width, height, true, textMeasurer, model.Background))
            {
                model.Update(true);
                model.Render(rc, width, height);
                rc.Complete();
                rc.Flush();
            }
        }
コード例 #5
0
ファイル: SvgExporter.cs プロジェクト: am1752/StudyCSharpp
        /// <summary>
        /// Exports the specified model to a stream.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="stream">The output stream.</param>
        /// <param name="width">The width (points).</param>
        /// <param name="height">The height (points).</param>
        /// <param name="isDocument">if set to <c>true</c>, the xml headers will be included (?xml and !DOCTYPE).</param>
        /// <param name="textMeasurer">The text measurer.</param>
        /// <param name="useVerticalTextAlignmentWorkaround">Whether to use the workaround for vertical text alignment</param>
        public static void Export(IPlotModel model, Stream stream, double width, double height, bool isDocument, IRenderContext textMeasurer = null, bool useVerticalTextAlignmentWorkaround = false)
        {
            if (textMeasurer == null)
            {
                textMeasurer = new PdfRenderContext(width, height, model.Background);
            }

            using (var rc = new SvgRenderContext(stream, width, height, isDocument, textMeasurer, model.Background, useVerticalTextAlignmentWorkaround))
            {
                model.Update(true);
                model.Render(rc, new OxyRect(0, 0, width, height));
                rc.Complete();
                rc.Flush();
            }
        }