Exemplo n.º 1
0
        public override LayerChange[] Use(Layer layer, Coordinates[] mouseMove, Color color)
        {
            LayerChange[] result        = new LayerChange[affectedLayers.Length];
            var           end           = mouseMove[0];
            var           lastSelection = currentSelection.ToArray();

            for (int i = 0; i < affectedLayers.Length; i++)
            {
                if (currentSelection.Length > 0)
                {
                    endPixelColors = BitmapUtils.GetPixelsForSelection(affectedLayers, currentSelection);
                    var changes = MoveSelection(affectedLayers[i], mouseMove);
                    ClearSelectedPixels(affectedLayers[i], lastSelection);

                    changes = RemoveTransparentPixels(changes);

                    result[i] = new LayerChange(changes, affectedLayers[i]);
                }
                else
                {
                    var vector = Transform.GetTranslation(lastMouseMove, end);
                    affectedLayers[i].Offset = new Thickness(affectedLayers[i].OffsetX + vector.X, affectedLayers[i].OffsetY + vector.Y, 0, 0);
                    result[i] = new LayerChange(BitmapPixelChanges.Empty, affectedLayers[i]);
                }
            }

            lastMouseMove = end;

            return(result);
        }
Exemplo n.º 2
0
        private Coordinates[] TranslateSelection(Coordinates end)
        {
            Coordinates translation = Transform.GetTranslation(lastMouseMove, end);

            return(Transform.Translate(currentSelection, translation));
        }