Exemple #1
0
        /// <summary>
        /// Overrides <see cref="LayerInfo.UpdateLayer(INgsPFLayer, LayerInfo)" />.
        /// </summary>
        public override void UpdateLayer(INgsPFLayer layer, LayerInfo previous)
        {
            if (previous is SolidColorLayerInfo p)
            {
                if (FillColor != p.FillColor)
                {
                    layer.SetContentsSolidColor(FillColor);
                }
            }
            else
            {
                layer.SetContentsSolidColor(FillColor);
            }

            base.UpdateLayer(layer, previous);
        }
Exemple #2
0
            public void Enter(LayerInfo info)
            {
                if (info != null)
                {
                    if (this.info != null && this.info.GetType() != info.GetType())
                    {
                        // The dynamic type has changed - invalidate the layer
                        this.pfLayer = null;
                        this.info    = null;
                    }

                    if (this.pfLayer == null)
                    {
                        this.pfLayer = emitter.context.CreateLayer();
                    }

                    info.UpdateLayer(this.pfLayer, this.info);
                }
                else
                {
                    // Creation of the corresponding node is deferred until the call to `Leave`.
                    this.pfLayer = null;
                }
                this.info = info;

                this.newChildrenRaw.Clear();

                // Clear all "visited" flags
                this.nextIndex = 0;
                if (keywordChildDefs != null)
                {
                    foreach (var child in keywordChildDefs)
                    {
                        child.Value.visited = false;
                    }
                }
                if (this.mask != null)
                {
                    this.mask.visited = false;
                }
            }
Exemple #3
0
        /// <summary>
        /// Overrides <see cref="LayerInfo.UpdateLayer(INgsPFLayer, LayerInfo)" />.
        /// </summary>
        public override void UpdateLayer(INgsPFLayer layer, LayerInfo previous)
        {
            if (previous is ImageLayerInfo p)
            {
                if (Image == p.Image && Source == p.Source && WrapMode == p.WrapMode)
                {
                    goto skip;
                }
            }

            if (Image != null)
            {
                layer.SetContentsImage(Image.NativeImage, Source, WrapMode);
            }
            else
            {
                layer.SetContentsEmpty();
            }

skip:
            base.UpdateLayer(layer, previous);
        }