Create() public static method

Creates a new XLayer instance.
public static Create ( string name = "Layer", XContainer owner = null, bool isVisible = true ) : XLayer
name string The layer name.
owner XContainer The layer owner.
isVisible bool The flag indicating whether layer is visible.
return XLayer
Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="XContainer"/> page instance.
        /// </summary>
        /// <param name="name">The page name.</param>
        /// <returns>The new instance of the <see cref="XContainer"/>.</returns>
        public static XContainer CreatePage(string name = "Page")
        {
            var page = new XContainer()
            {
                Name = name
            };

            var builder = page.Layers.ToBuilder();

            builder.Add(XLayer.Create("Layer1", page));
            builder.Add(XLayer.Create("Layer2", page));
            builder.Add(XLayer.Create("Layer3", page));
            page.Layers = builder.ToImmutable();

            page.CurrentLayer = page.Layers.FirstOrDefault();
            page.WorkingLayer = XLayer.Create("Working", page);
            page.HelperLayer  = XLayer.Create("Helper", page);

            return(page);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new <see cref="XContainer"/> template instance.
        /// </summary>
        /// <param name="name">The template name.</param>
        /// <param name="width">The template width.</param>
        /// <param name="height">The template height.</param>
        /// <returns>The new instance of the <see cref="XContainer"/>.</returns>
        public static XContainer CreateTemplate(string name = "Template", double width = 840, double height = 600)
        {
            var template = new XContainer()
            {
                Name = name
            };

            template.Background = ArgbColor.Create(0x00, 0xFF, 0xFF, 0xFF);
            template.Width      = width;
            template.Height     = height;

            var builder = template.Layers.ToBuilder();

            builder.Add(XLayer.Create("TemplateLayer1", template));
            builder.Add(XLayer.Create("TemplateLayer2", template));
            builder.Add(XLayer.Create("TemplateLayer3", template));
            template.Layers = builder.ToImmutable();

            template.CurrentLayer = template.Layers.FirstOrDefault();
            template.WorkingLayer = XLayer.Create("TemplateWorking", template);
            template.HelperLayer  = XLayer.Create("TemplateHelper", template);

            return(template);
        }