/// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private static Brush CreateBrush(ArgbColor color)
 {
     var brush = new SolidColorBrush(
         Color.FromArgb(
             (byte)color.A,
             (byte)color.R,
             (byte)color.G,
             (byte)color.B));
     brush.Freeze();
     return brush;
 }
Exemple #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="g"></param>
 /// <param name="c"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 private void DrawBackground(Graphics g, ArgbColor c, double width, double height)
 {
     var brush = new SolidBrush(Color.FromArgb(c.A, c.R, c.G, c.B));
     var rect = Rect2.Create(0, 0, width, height);
     g.FillRectangle(
         brush,
         (float)rect.X,
         (float)rect.Y,
         (float)rect.Width,
         (float)rect.Height);
     brush.Dispose();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private SolidBrush ToSolidBrush(ArgbColor color)
 {
     return new SolidBrush(ToColor(color));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private Color ToColor(ArgbColor color)
 {
     return Color.FromArgb(
         color.A,
         color.R,
         color.G,
         color.B);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="stroke"></param>
 /// <param name="fill"></param>
 /// <param name="thickness"></param>
 /// <param name="textStyle"></param>
 /// <param name="lineStyle"></param>
 /// <param name="startArrowStyle"></param>
 /// <param name="endArrowStyle"></param>
 /// <returns></returns>
 public static ShapeStyle Create(
     string name,
     ArgbColor stroke,
     ArgbColor fill,
     double thickness,
     TextStyle textStyle,
     LineStyle lineStyle,
     ArrowStyle startArrowStyle,
     ArrowStyle endArrowStyle)
 {
     return new ShapeStyle()
     {
         Name = name,
         Stroke = stroke,
         Fill = fill,
         Thickness = thickness,
         LineCap = LineCap.Round,
         Dashes = default(string),
         DashOffset = 0.0,
         LineStyle = lineStyle,
         TextStyle = textStyle,
         StartArrowStyle = startArrowStyle,
         EndArrowStyle = endArrowStyle
     };
 }