Пример #1
0
        override public bool Execute()
        {
            double newWidth  = ActiveDrawable.Width;
            double newHeight = ActiveDrawable.Height;
            double oldWidth  = newWidth;
            double oldHeight = newHeight;

            Offset oldOffset = SelectedLayer.Offsets;

            var width = Parameters["Wdth"] as DoubleParameter;

            if (width != null)
            {
                newWidth = width.GetPixels(SelectedLayer.Width);
            }

            var height = Parameters["Hght"] as DoubleParameter;

            if (height != null)
            {
                newHeight = width.GetPixels(SelectedLayer.Height);
            }

            if (_needScaling)
            {
                SelectedLayer.Scale((int)newWidth, (int)newHeight, true);

                EnumParameter side = Parameters["FTcs"] as EnumParameter;

                switch (side.Value)
                {
                case "Qcs7":
                    SelectedLayer.Offsets = oldOffset;
                    break;

                case "Qcs5":
                    SelectedLayer.Offsets =
                        new Offset(oldOffset.X + (int)(oldWidth - newWidth),
                                   oldOffset.Y + (int)(oldHeight - newHeight));
                    break;

                case "Qcsa":
                    Console.WriteLine("TransformLayerEvent: Qcsa not supported yet");
                    break;

                default:
                    Console.WriteLine("FTcs: " + side.Value);
                    break;
                }
            }

            Offset();
            Translate();
            Skew();
            Rotate();

            return(true);
        }