コード例 #1
0
 public override void applyTransform(Layer child, Matrix3 transform)
 {
     D.assert(child != null);
     D.assert(transform != null);
     transform.preTranslate((float)this.offset.dx, (float)this.offset.dy);
 }
コード例 #2
0
 public virtual void applyTransform(Layer child, Matrix3 transform)
 {
     D.assert(child != null);
     D.assert(transform != null);
 }
コード例 #3
0
        void _establishTransform()
        {
            D.assert(this.link != null);
            this._lastTransform = null;
            if (this.link._leader == null)
            {
                return;
            }

            D.assert(this.link.leader.owner == this.owner,
                     () => "Linked LeaderLayer anchor is not in the same layer tree as the FollowerLayer.");
            D.assert(this.link.leader._lastOffset != null,
                     () => "LeaderLayer anchor must come before FollowerLayer in paint order, but the reverse was true.");

            HashSet <Layer> ancestors = new HashSet <Layer>();
            Layer           ancestor  = this.parent;

            while (ancestor != null)
            {
                ancestors.Add(ancestor);
                ancestor = ancestor.parent;
            }

            ContainerLayer        layer         = this.link.leader;
            List <ContainerLayer> forwardLayers = new List <ContainerLayer> {
                null, layer
            };

            do
            {
                layer = layer.parent;
                forwardLayers.Add(layer);
            } while (!ancestors.Contains(layer));

            ancestor = layer;

            layer = this;
            List <ContainerLayer> inverseLayers = new List <ContainerLayer> {
                layer
            };

            do
            {
                layer = layer.parent;
                inverseLayers.Add(layer);
            } while (layer != ancestor);

            Matrix3 forwardTransform = this._collectTransformForLayerChain(forwardLayers);
            Matrix3 inverseTransform = this._collectTransformForLayerChain(inverseLayers);
            var     inverse          = Matrix3.I();
            var     invertible       = inverseTransform.invert(inverse);

            if (!invertible)
            {
                return;
            }

            inverseTransform = inverse;
            inverseTransform.preConcat(forwardTransform);
            inverseTransform.preTranslate(this.linkedOffset.dx, this.linkedOffset.dy);
            this._lastTransform = inverseTransform;
            this._inverseDirty  = true;
        }
コード例 #4
0
        protected List <PictureLayer> _debugCheckElevations()
        {
            List <PhysicalModelLayer> physicalModelLayers =
                this.depthFirstIterateChildren().OfType <PhysicalModelLayer>().ToList();
            List <PictureLayer> addedLayers = new List <PictureLayer>();

            for (int i = 0; i < physicalModelLayers.Count; i++)
            {
                PhysicalModelLayer physicalModelLayer = physicalModelLayers[i];
                D.assert(physicalModelLayer.lastChild?.debugCreator != physicalModelLayer,
                         () => "debugCheckElevations has either already visited this layer or failed to remove the" +
                         " added picture from it.");
                float accumulatedElevation = physicalModelLayer.elevation;
                Layer ancestor             = physicalModelLayer.parent;
                while (ancestor != null)
                {
                    if (ancestor is PhysicalModelLayer modelLayer)
                    {
                        accumulatedElevation += modelLayer.elevation;
                    }

                    ancestor = ancestor.parent;
                }

                for (int j = 0; j <= i; j++)
                {
                    PhysicalModelLayer predecessor        = physicalModelLayers[j];
                    float predecessorAccumulatedElevation = predecessor.elevation;
                    ancestor = predecessor.parent;
                    while (ancestor != null)
                    {
                        if (ancestor == predecessor)
                        {
                            continue;
                        }

                        if (ancestor is PhysicalModelLayer modelLayer)
                        {
                            predecessorAccumulatedElevation += modelLayer.elevation;
                        }

                        ancestor = ancestor.parent;
                    }

                    if (predecessorAccumulatedElevation <= accumulatedElevation)
                    {
                        continue;
                    }

                    Path intersection = Path.combine(
                        PathOperation.intersect,
                        predecessor._debugTransformedClipPath,
                        physicalModelLayer._debugTransformedClipPath);

                    if (intersection != null && intersection.computeMetrics().Any((metric) => metric.length > 0))
                    {
                        addedLayers.AddRange(this._processConflictingPhysicalLayers(predecessor, physicalModelLayer));
                    }
                }
            }

            return(addedLayers);
        }
コード例 #5
0
 public override void applyTransform(Layer child, Matrix3 transform)
 {
     D.assert(child != null);
     transform.preConcat(this._lastEffectiveTransform);
 }