コード例 #1
0
        private void DrawBackground(CanvasDrawingSession ds, T2d.ArgbColor c, double width, double height)
        {
            var color = Color.FromArgb(c.A, c.R, c.G, c.B);
            var rect  = T2d.Rect2.Create(0, 0, width, height);

            ds.FillRectangle(
                (float)rect.X,
                (float)rect.Y,
                (float)rect.Width,
                (float)rect.Height,
                color);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="project"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public Container GetTemplate(Project project, string name)
        {
            var container = Container.Create(name);

            container.IsTemplate = true;
            container.Background = ArgbColor.Create(0xFF, 0xFF, 0xFF, 0xFF);

            foreach (var layer in container.Layers)
            {
                layer.Name = string.Concat("Template", layer.Name);
            }

            return(container);
        }
コード例 #3
0
ファイル: ArrowStyle.cs プロジェクト: gitter-badger/Test2d
        /// <summary>
        /// Copy base style from BaseStyle source.
        /// </summary>
        /// <param name="source">The BaseStyle source object.</param>
        public ArrowStyle(BaseStyle source)
        {
            Stroke = ArgbColor.Create
                         (source.Stroke.A,
                         source.Stroke.R,
                         source.Stroke.G,
                         source.Stroke.B);
            Fill = ArgbColor.Create
                       (source.Fill.A,
                       source.Fill.R,
                       source.Fill.G,
                       source.Fill.B);
            Thickness = source.Thickness;
            LineCap   = source.LineCap;
            Dashes    = source.Dashes != null?source.Dashes.ToArray() : default(double[]);

            DashOffset = source.DashOffset;
        }
コード例 #4
0
ファイル: EmfRenderer.cs プロジェクト: monocraft/Test2d
 /// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private Color ToColor(ArgbColor color)
 {
     return Color.FromArgb(
         color.A,
         color.R,
         color.G,
         color.B);
 }
コード例 #5
0
ファイル: EmfRenderer.cs プロジェクト: monocraft/Test2d
 /// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private SolidBrush ToSolidBrush(ArgbColor color)
 {
     return new SolidBrush(ToColor(color));
 }
コード例 #6
0
ファイル: Drawable.cs プロジェクト: gitter-badger/Test2d
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dc"></param>
 /// <param name="c"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 private void DrawBackground(DrawingContext dc, ArgbColor c, double width, double height)
 {
     var color = Color.FromArgb(c.A, c.R, c.G, c.B);
     var brush = new SolidColorBrush(color);
     var rect = new Rect(0, 0, width, height);
     dc.FillRectangle(brush, rect);
     // TODO: brush.Dispose();
 }
コード例 #7
0
ファイル: Drawable.cs プロジェクト: gitter-badger/Test2d
 /// <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();
 }
コード例 #8
0
ファイル: WpfRenderer.cs プロジェクト: monocraft/Test2d
 /// <summary>
 /// 
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private static Brush CreateBrush(ArgbColor color)
 {
     var brush = new SolidColorBrush(
         Color.FromArgb(
             color.A,
             color.R,
             color.G,
             color.B));
     brush.Freeze();
     return brush;
 }
コード例 #9
0
ファイル: ShapeStyle.cs プロジェクト: gitter-badger/Test2d
 /// <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(double[]),
         DashOffset = 0.0,
         LineStyle = lineStyle,
         TextStyle = textStyle,
         StartArrowStyle = startArrowStyle,
         EndArrowStyle = endArrowStyle
     };
 }
コード例 #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private SolidBrush ToSolidBrush(ArgbColor color)
 {
     return(new SolidBrush(ToColor(color)));
 }