예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static Container Create(string name = "Container", double width = 840, double height = 600)
        {
            var c = new Container()
            {
                Name       = name,
                Width      = width,
                Height     = height,
                Background = ArgbColor.Create(0x00, 0xFF, 0xFF, 0xFF),
                Properties = ImmutableArray.Create <ShapeProperty>(),
                Layers     = ImmutableArray.Create <Layer>()
            };

            var builder = c.Layers.ToBuilder();

            builder.Add(Layer.Create("Layer1", c));
            builder.Add(Layer.Create("Layer2", c));
            builder.Add(Layer.Create("Layer3", c));
            builder.Add(Layer.Create("Layer4", c));
            c.Layers = builder.ToImmutable();

            c.CurrentLayer = c.Layers.FirstOrDefault();
            c.WorkingLayer = Layer.Create("Working", c);
            c.HelperLayer  = Layer.Create("Helper", c);

            return(c);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="sa"></param>
        /// <param name="sr"></param>
        /// <param name="sg"></param>
        /// <param name="sb"></param>
        /// <param name="fa"></param>
        /// <param name="fr"></param>
        /// <param name="fg"></param>
        /// <param name="fb"></param>
        /// <param name="thickness"></param>
        /// <param name="textStyle"></param>
        /// <param name="lineStyle"></param>
        /// <param name="startArrowStyle"></param>
        /// <param name="endArrowStyle"></param>
        /// <param name="lineCap"></param>
        /// <param name="dashes"></param>
        /// <param name="dashOffset"></param>
        /// <returns></returns>
        public static ShapeStyle Create(
            string name                = "",
            byte sa                    = 0xFF, byte sr = 0x00, byte sg = 0x00, byte sb = 0x00,
            byte fa                    = 0xFF, byte fr = 0x00, byte fg = 0x00, byte fb = 0x00,
            double thickness           = 2.0,
            TextStyle textStyle        = null,
            LineStyle lineStyle        = null,
            ArrowStyle startArrowStyle = null,
            ArrowStyle endArrowStyle   = null,
            LineCap lineCap            = LineCap.Round,
            double[] dashes            = default(double[]),
            double dashOffset          = 0.0)
        {
            var style = new ShapeStyle()
            {
                Name       = name,
                Stroke     = ArgbColor.Create(sa, sr, sg, sb),
                Fill       = ArgbColor.Create(fa, fr, fg, fb),
                Thickness  = thickness,
                LineCap    = lineCap,
                Dashes     = dashes,
                DashOffset = dashOffset,
                LineStyle  = lineStyle ?? LineStyle.Create("Line"),
                TextStyle  = textStyle ?? TextStyle.Create("Text")
            };

            style.StartArrowStyle = startArrowStyle ?? ArrowStyle.Create("Start", style);
            style.EndArrowStyle   = endArrowStyle ?? ArrowStyle.Create("End", style);

            return(style);
        }
예제 #3
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);
        }
예제 #4
0
        /// <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;
        }