Esempio n. 1
0
 internal void EnsureRenderedGeometry()
 {
     if (this._renderedGeometry == null)
     {
         this._renderedGeometry = this.DefiningGeometry;
         if (this.Stretch != Stretch.None)
         {
             Geometry objB = this._renderedGeometry.CloneCurrentValue();
             if (object.ReferenceEquals(this._renderedGeometry, objB))
             {
                 this._renderedGeometry = objB.Clone();
             }
             else
             {
                 this._renderedGeometry = objB;
             }
             Transform transform = this._renderedGeometry.Transform;
             //BoxedMatrix matrix = StretchMatrixField.GetValue(this);
             BoxedMatrix matrix  = StretchMatrix;
             Matrix      matrix2 = (matrix == null) ? Matrix.Identity : matrix.Value;
             //if ((transform == null) || transform.IsIdentity)
             if ((transform == null) || transform == Transform.Identity)
             {
                 this._renderedGeometry.Transform = new MatrixTransform(matrix2);
             }
             else
             {
                 this._renderedGeometry.Transform = new MatrixTransform(transform.Value * matrix2);
             }
         }
     }
 }
Esempio n. 2
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            Size    size;
            Stretch mode = this.Stretch;

            if (mode == Stretch.None)
            {
                //StretchMatrixField.ClearValue(this);
                StretchMatrix = null;
                this.ResetRenderedGeometry();
                size = finalSize;
            }
            else
            {
                size = this.GetStretchedRenderSizeAndSetStretchMatrix(mode, this.GetStrokeThickness(), finalSize, this.GetDefiningGeometryBounds());
            }
            if (this.SizeIsInvalidOrEmpty(size))
            {
                size = new Size(0.0, 0.0);
                this._renderedGeometry = Geometry.Empty;
            }
            return(size);
        }