示例#1
0
        public static System.Windows.Media.Brush ToWpf(this Altaxo.Graph.Gdi.BrushX brushx)
        {
            System.Windows.Media.Color c = ToWpf(brushx.Color);
            var result = new System.Windows.Media.SolidColorBrush(c);

            return(result);
        }
示例#2
0
        public void Run1()
        {
            var brush = new Altaxo.Graph.Gdi.BrushX(NamedColors.Black);
            var ctrl  = new Altaxo.Gui.Common.Drawing.BrushControllerAdvanced();

            ctrl.InitializeDocument(brush);
            Current.Gui.ShowDialog(ctrl, "Brush pros");
        }
示例#3
0
 /// <summary>Converts a brush to a Wpf <see cref="ImageSource"/> instance.</summary>
 /// <param name="brush">The brush to convert.</param>
 /// <param name="xsize">The horizontal number of pixels of the image.</param>
 /// <param name="ysize">The vertical number of pixels of the image.</param>
 /// <returns>An image that represents the brush.</returns>
 public static ImageSource ToWpf(Altaxo.Graph.Gdi.BrushX brush, int xsize, int ysize)
 {
     using (var bmp = new System.Drawing.Bitmap(xsize, ysize, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
     {
         using (var g = System.Drawing.Graphics.FromImage(bmp))
         {
             brush.SetEnvironment(new RectangleD2D(0, 0, xsize, ysize), 96);
             g.FillRectangle(brush, 0, 0, xsize, ysize);
         }
         var stream  = Altaxo.Graph.ImageProxy.ImageToStream(bmp, System.Drawing.Imaging.ImageFormat.Png);
         var decoder = System.Windows.Media.Imaging.BitmapDecoder.Create(stream, System.Windows.Media.Imaging.BitmapCreateOptions.None, System.Windows.Media.Imaging.BitmapCacheOption.Default);
         return(decoder.Frames[0]);
     }
 }
示例#4
0
 public void Color_Initialize(Altaxo.Graph.Gdi.BrushX color)
 {
     this.m_cbColor.ColorChoice = color.Color;
 }
        /// <summary>
        /// Copies the current graph as an bitmap image to the clipboard in native bmp format.
        /// </summary>
        /// <param name="doc">Graph to copy to the clipboard.</param>
        /// <param name="dpiResolution">Resolution of the bitmap in dpi. Determines the pixel size of the bitmap.</param>
        /// <param name="backbrush">Brush used to fill the background of the image. Can be <c>null</c>.</param>
        /// <param name="pixelformat">Specify the pixelformat here.</param>
        public static void CopyToClipboardAsBitmap(this GraphDocument doc, int dpiResolution, Altaxo.Graph.Gdi.BrushX backbrush, PixelFormat pixelformat)
        {
            var dao = Current.Gui.GetNewClipboardDataObject();

            System.Drawing.Bitmap bitmap = GraphDocumentExportActions.RenderAsBitmap(doc, backbrush, pixelformat, dpiResolution, dpiResolution);
            dao.SetImage(bitmap);
            Current.Gui.SetClipboardDataObject(dao);
        }