Пример #1
0
        /// <summary>
        /// Performs the copy operation.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs" /> instance containing the event data.</param>
        private void DoCopy(object sender, ExecutedRoutedEventArgs e)
        {
            var background = ReferenceEquals(this.Background, Brushes.Transparent) ? Brushes.White : this.Background;
            var bitmap     = PngExporter.ExportToBitmap(
                this.ActualModel, (int)this.ActualWidth, (int)this.ActualHeight, background.ToOxyColor());

            Clipboard.SetImage(bitmap);
        }
Пример #2
0
        /// <summary>
        /// Renders the PlotView to a bitmap.
        /// </summary>
        /// <returns>A bitmap.</returns>
        public BitmapSource ToBitmap()
        {
            var exporter = new PngExporter()
            {
                Width = (int)this.ActualWidth, Height = (int)this.ActualHeight
            };

            return(exporter.ExportToBitmap(this.ActualModel));
        }
Пример #3
0
        /// <summary>
        /// Renders the PlotView to a bitmap.
        /// </summary>
        /// <returns>A bitmap.</returns>
        public BitmapSource ToBitmap()
        {
            var background = this.ActualModel.Background.IsVisible() ? this.ActualModel.Background : this.Background.ToOxyColor();
            var exporter   = new PngExporter()
            {
                Width = (int)this.ActualWidth, Height = (int)this.ActualHeight
            };

            return(exporter.ExportToBitmap(this.ActualModel));
        }
Пример #4
0
        /// <summary>
        /// Performs the copy operation.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs" /> instance containing the event data.</param>
        private void DoCopy(object sender, ExecutedRoutedEventArgs e)
        {
            var exporter = new PngExporter()
            {
                Width = (int)this.ActualWidth, Height = (int)this.ActualHeight
            };
            var bitmap = exporter.ExportToBitmap(this.ActualModel);

            Clipboard.SetImage(bitmap);
        }
Пример #5
0
        /// <summary>
        /// Exports the specified plot model to a bitmap.
        /// </summary>
        /// <param name="model">The plot model.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="background">The background.</param>
        /// <param name="resolution">The resolution (dpi).</param>
        /// <returns>A bitmap.</returns>
        public static BitmapSource ExportToBitmap(
            PlotModel model,
            int width,
            int height,
            OxyColor background,
            int resolution = 96)
        {
            var exporter = new PngExporter {
                Width = width, Height = height, Background = background, Resolution = resolution
            };

            return(exporter.ExportToBitmap(model));
        }
Пример #6
0
        /// <summary>
        /// Performs the copy operation.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs" /> instance containing the event data.</param>
        private void DoCopy(object sender, ExecutedRoutedEventArgs e)
        {
            var background = this.ActualModel.Background.IsVisible() ? this.ActualModel.Background : this.Background.ToOxyColor();

            if (background.IsInvisible())
            {
                background = OxyColors.White;
            }

            var bitmap = PngExporter.ExportToBitmap(
                this.ActualModel, (int)this.ActualWidth, (int)this.ActualHeight, background);

            Clipboard.SetImage(bitmap);
        }
Пример #7
0
 /// <summary>
 /// Renders the PlotView to a bitmap.
 /// </summary>
 /// <returns>A bitmap.</returns>
 public BitmapSource ToBitmap()
 {
     return(PngExporter.ExportToBitmap(this.ActualModel, (int)this.ActualWidth, (int)this.ActualHeight, this.Background.ToOxyColor()));
 }
Пример #8
0
        /// <summary>
        /// Renders the PlotView to a bitmap.
        /// </summary>
        /// <returns>A bitmap.</returns>
        public BitmapSource ToBitmap()
        {
            var background = this.ActualModel.Background.IsVisible() ? this.ActualModel.Background : this.Background.ToOxyColor();

            return(PngExporter.ExportToBitmap(this.ActualModel, (int)this.ActualWidth, (int)this.ActualHeight, background));
        }
Пример #9
-2
 /// <summary>
 /// Exports the specified plot model to a bitmap.
 /// </summary>
 /// <param name="model">The plot model.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="background">The background.</param>
 /// <param name="resolution">The resolution (dpi).</param>
 /// <returns>A bitmap.</returns>
 public static BitmapSource ExportToBitmap(
     PlotModel model,
     int width,
     int height,
     OxyColor background,
     int resolution = 96)
 {
     var exporter = new PngExporter { Width = width, Height = height, Background = background, Resolution = resolution };
     return exporter.ExportToBitmap(model);
 }