Пример #1
0
 public TextureScaling(TextureScalingMode mode, AspectRatioPreservingMode aspectPreserving, double x, double y)
 {
     _scalingMode      = mode;
     _aspectPreserving = aspectPreserving;
     _x = x;
     _y = y;
 }
        public override bool CopyFrom(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            if (obj is ItemLocationDirectAspectPreserving)
            {
                var from = (ItemLocationDirectAspectPreserving)obj;
                _originalItemSize = from._originalItemSize;
                _aspectPreserving = from._aspectPreserving;
            }

            if (obj is ItemLocationDirect)
            {
                var from = (ItemLocationDirect)obj;
                _parentSize = from.ParentSize;
                InternalSetSizeSilent(from.SizeX * from.ScaleX, from.SizeY * from.ScaleY);
                _scaleX        = _scaleY = 1;
                _positionX     = from.PositionX;
                _positionY     = from.PositionY;
                _localAnchorX  = from.LocalAnchorX;
                _localAnchorY  = from.LocalAnchorY;
                _parentAnchorX = from.ParentAnchorX;
                _parentAnchorY = from.ParentAnchorY;
                _rotation      = from.Rotation;
                _shear         = from.ShearX;
                EhSelfChanged();
                return(true);
            }
            else if (obj is IItemLocation)
            {
                var from = (IItemLocation)obj;
                _rotation = from.Rotation;
                _shear    = from.ShearX;
                InternalSetScaleSilent(new PointD2D(from.ScaleX, from.ScaleY));
                _scaleX = _scaleY = 1;
                EhSelfChanged();
                return(true);
            }

            return(false);
        }
		public override bool CopyFrom(object obj)
		{
			if (object.ReferenceEquals(this, obj))
				return true;

			if (obj is ItemLocationDirectAspectPreserving)
			{
				var from = (ItemLocationDirectAspectPreserving)obj;
				this._originalItemSize = from._originalItemSize;
				this._aspectPreserving = from._aspectPreserving;
			}

			if (obj is ItemLocationDirect)
			{
				var from = (ItemLocationDirect)obj;
				this._parentSize = from.ParentSize;
				InternalSetSizeSilent(from.SizeX * from.ScaleX, from.SizeY * from.ScaleY, from.SizeZ * from.ScaleZ);

				this._scaleX = 1;
				this._scaleY = 1;
				this._scaleZ = 1;
				this._positionX = from.PositionX;
				this._positionY = from.PositionY;
				this._positionZ = from.PositionZ;
				this._localAnchorX = from.LocalAnchorX;
				this._localAnchorY = from.LocalAnchorY;
				this._localAnchorZ = from.LocalAnchorZ;
				this._parentAnchorX = from.ParentAnchorX;
				this._parentAnchorY = from.ParentAnchorY;
				this._parentAnchorZ = from.ParentAnchorZ;
				this._rotationX = from.RotationX;
				this._rotationY = from.RotationY;
				this._rotationZ = from.RotationZ;
				this._shearX = from.ShearX;
				this._shearY = from.ShearY;
				this._shearZ = from.ShearZ;

				EhSelfChanged();
				return true;
			}
			else if (obj is IItemLocation)
			{
				var from = (IItemLocation)obj;

				this._rotationX = from.RotationX;
				this._rotationY = from.RotationY;
				this._rotationZ = from.RotationZ;
				this._shearX = from.ShearX;
				this._shearY = from.ShearY;
				this._shearZ = from.ShearZ;

				this.InternalSetScaleSilent(new VectorD3D(from.ScaleX, from.ScaleY, from.ScaleZ));

				EhSelfChanged();
				return true;
			}

			return false;
		}