Exemplo n.º 1
0
        override public bool Execute()
        {
            bool nonEmpty;

            var rectangle = ActiveImage.Selection.Bounds(out nonEmpty);

            if (nonEmpty)
            {
                ActiveDrawable.EditCopy();
                ActiveDrawable.EditPaste(false);

                ActiveImage.FloatingSelection.Offsets =
                    new Offset(rectangle.X1, rectangle.Y1);
                var layer = ActiveImage.FloatingSelection.ToLayer();

                // Fix me: why can't I use layer here?
                var dummy = new Layer(ActiveImage.ActiveDrawable)
                {
                    Name = "Layer 1"
                };
                dummy.ResizeToImageSize();
            }
            else
            {
                var image = ActiveImage;
                var layer = new Layer(SelectedLayer)
                {
                    Name = "Layer 1"
                };
                image.InsertLayer(layer, 0);
                image.ActiveLayer = layer;
                SelectedLayer     = layer;
            }
            return(true);
        }
Exemplo n.º 2
0
        override public bool Execute()
        {
            var selection = ActiveDrawable.EditPaste(false);

            selection.ToLayer();

            selection.Name = "Layer 1";

            SelectedLayer = selection;
            return(true);
        }
Exemplo n.º 3
0
        override public bool Execute()
        {
            bool nonEmpty;

            Rectangle rectangle = ActiveImage.Selection.Bounds(out nonEmpty);

            if (nonEmpty)
            {
                ActiveDrawable.EditCut();
                ActiveDrawable.EditPaste(false);

                ActiveImage.FloatingSelection.Offsets =
                    new Offset(rectangle.X1, rectangle.Y1);
                Layer layer = ActiveImage.FloatingSelection.ToLayer();
                // Fix me: why can't I use layer here?
                new Layer(ActiveImage.ActiveDrawable).ResizeToImageSize();
            }
            else
            {
                // TODO: what does PS handle this?
            }
            return(true);
        }
Exemplo n.º 4
0
 override public bool Execute()
 {
     ActiveDrawable.EditPaste(true);
     return(true);
 }