/// <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); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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); }
/// <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())); }
/// <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)); }
/// <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); }